Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
5d389fe
Linting
Philipose Jun 24, 2020
8ad3c80
PAF-20 #First Working Test Case
Philipose Jun 24, 2020
2312a95
Fixing Smells
Philipose Jun 24, 2020
4497d66
PAF-20 #Adding CircleCI for testing
Philipose Jun 24, 2020
01d5ad4
Fixing Path
Philipose Jun 24, 2020
d5f5956
Trying to trigger CircleCI
Philipose Jun 24, 2020
66bc897
fixing working directory
Philipose Jun 24, 2020
0425e8b
Updating Pipfiles to 3.8
Philipose Jun 24, 2020
37c70e3
PAF-20 #Adjusting Naming for MockServer Tests
Philipose Jul 15, 2020
f526c5c
Merge pull request #10 from dynatrace-api-framework/PAF-20_Host_Group…
Philipose Jul 15, 2020
66e447b
Merge pull request #11 from dynatrace-api-framework/dev
Philipose Jul 15, 2020
b8e7d5b
Removing Unused Function
Philipose Jul 24, 2020
e208487
changes as per framework_changes.docx; merge from my codebase
radu-stefan-dt Jul 24, 2020
07971e8
Merge pull request #12 from radu-stefan-dt/master
Philipose Jul 27, 2020
3316889
PAF-31 #Moving timeseries to tenant pkg
Philipose Jul 29, 2020
04ed021
PAF-32 #Moving topology into tenant pkg
Philipose Jul 29, 2020
093ea40
PAF-32 #Adding a newline
Philipose Jul 29, 2020
a008803
PAF-31 #Desmelling variable names
Philipose Jul 29, 2020
d79b191
PAF-32 #Redoing layer_list & adding endpoint const
Philipose Jul 29, 2020
bc0ed34
PAF-32 #Desmelling Variable Names
Philipose Jul 29, 2020
ef560aa
PAF-19 #Refactoring hosts exceptions to b specific
Philipose Jul 29, 2020
612163c
PAF-19 #Making topology exceptions more accurate
Philipose Jul 29, 2020
bcb3d80
PAF-19 #Desmelling Applications excetion [skip ci]
Philipose Jul 29, 2020
237a97e
Merge pull request #13 from dynatrace-api-framework/PAF-30_Refactorin…
Philipose Jul 29, 2020
301f965
PAF-33 Fixing test tooling's insecure SSL suppress
Philipose Jul 29, 2020
30cbefa
fixing host_groups import since topology moved
Philipose Jul 29, 2020
98216f4
Merge pull request #14 from dynatrace-api-framework/PAF-33_bugfix_tes…
Philipose Jul 29, 2020
e92b5e6
Merge pull request #15 from dynatrace-api-framework/dev
Philipose Jul 29, 2020
adb5ce9
PAF-19 #Creating file for all project exceptions
Philipose Jul 29, 2020
cb115b2
PAF-19 Adding Exception for Managed-Only
Philipose Jul 29, 2020
b345365
Merge pull request #17 from dynatrace-api-framework/PAF-19_Better_def…
Philipose Jul 29, 2020
ebc170f
Merge pull request #18 from dynatrace-api-framework/dev
Philipose Jul 29, 2020
012919a
#PAF -21 Adding MWindow & moving Host Group JSONs
Philipose Aug 3, 2020
6b1ebc7
PAF-21 #Changing unittest to discover in CircleCI
Philipose Aug 3, 2020
d9b1a3c
Think init file is needed for circleci discover
Philipose Aug 3, 2020
b36d769
PAF-21 First Maintenance Window Test
Philipose Aug 3, 2020
effed7d
PAF-21 #MW Create now returns JSON of new window
Philipose Aug 3, 2020
76d6ff6
PAF-21 #More Sensible Enums
Philipose Aug 3, 2020
0c9a2ea
PAF-21 #Refactored test JSON dir. Added Test Case
Philipose Aug 3, 2020
e6179d5
PAF-21 #Fixing Testing tool to match refactor
Philipose Aug 3, 2020
baed3ad
Merge pull request #19 from dynatrace-api-framework/PAF-21_Maintenanc…
Philipose Aug 4, 2020
100e9e2
PAF-21 fixed payload for 2nd Maintenance
Philipose Aug 5, 2020
392fed2
Create main.yml
Philipose Aug 5, 2020
11aa84c
Update and rename main.yml to linter.yml
Philipose Aug 5, 2020
50fb88c
Update linter.yml
Philipose Aug 5, 2020
b2c25a6
[no-ci] swiching to new validation
Philipose Aug 5, 2020
c32d2ea
Merge pull request #20 from dynatrace-api-framework/Philipose-patch-1
Philipose Aug 5, 2020
adb2dc9
Tests for Topology>Hosts functions
radu-stefan-dt Aug 5, 2020
9735c41
added venv for virtual environments
radu-stefan-dt Aug 5, 2020
2d36445
4 space formatting; added missing check so param isn't passed as None
radu-stefan-dt Aug 5, 2020
38fc964
Merge branch 'dev' of https://github.com/dynatrace-api-framework/pyth…
radu-stefan-dt Aug 5, 2020
84906a6
PAF-23 - Testing for Topology > Processes
radu-stefan-dt Aug 5, 2020
824dc13
changes from PAF-22 that should have been pushed to dev instead
radu-stefan-dt Aug 5, 2020
42db44f
Update test_processes.py
radu-stefan-dt Aug 5, 2020
bde9a78
Update test_processes.py
radu-stefan-dt Aug 5, 2020
07d3ce5
PAF-24 Testing for Topology > Process Groups
radu-stefan-dt Aug 5, 2020
794db69
triple quote one-liners should be all on one line (PEP8 style)
radu-stefan-dt Aug 5, 2020
ca3dc81
PAF-25 Testing for Topology > Services
radu-stefan-dt Aug 6, 2020
815dbb0
moved tags.json (request_file) to request payloads dir
radu-stefan-dt Aug 6, 2020
fc23279
python specific stuff on .gitignore
radu-stefan-dt Aug 6, 2020
4e90f5c
trimmed down mockserver payloads for hosts. edited test_hosts.py to w…
radu-stefan-dt Aug 6, 2020
20fa3f8
edited vars import to work with circleci mockserver vars
radu-stefan-dt Aug 6, 2020
73d2b48
Merge branch 'dev' into PAF-22
Philipose Aug 7, 2020
6329ce5
PAF-21 # New Tests, Consolidate Response to 1 now
Philipose Aug 7, 2020
fdef6c6
PAF-21 #Adding ANDs and ORs logic to maintenance
Philipose Aug 7, 2020
4470cd6
PAF-21 #Adding Multi-Tag Tests
Philipose Aug 7, 2020
4e3a6ab
PAF-21 # Added all useful Enums for maintenance
Philipose Aug 7, 2020
46c4304
PAF-21 #Format& maintenance validation to use enum
Philipose Aug 7, 2020
981da4d
simplified mockserver payloads; updated details as expected by circleCI
radu-stefan-dt Aug 9, 2020
1d81998
simplified mockserver payloads; changed connection details to circlec…
radu-stefan-dt Aug 9, 2020
a066f4c
changed mockcluster1 to mockserver1 to comply with circleci test details
radu-stefan-dt Aug 9, 2020
238685b
simplified mockserver payloads
radu-stefan-dt Aug 9, 2020
22dd669
changed test details to comply with circleci mockserver
radu-stefan-dt Aug 9, 2020
d10ac3d
PAF-37: simplified make_api_call function; moved Api-Token to headers…
radu-stefan-dt Aug 9, 2020
039b812
Adding coverage for testing breadth
Philipose Aug 10, 2020
b7ebcaa
PAF-21 #Adding Enum Tests
Philipose Aug 10, 2020
177da3a
Removing commented code
Philipose Aug 10, 2020
eaddf3f
PAF-21 #Added Recurrance Types. Refactored Payload
Philipose Aug 10, 2020
a430284
PAF-21 #Monthly now calls correct file
Philipose Aug 10, 2020
6124202
PAF-21 #Tag Parsing Logic
Philipose Aug 10, 2020
d808ddb
PAF-21 #Adding some exception test cases
Philipose Aug 10, 2020
ea683ef
PAF-21 #Fixed a Day of Month test function name
Philipose Aug 10, 2020
e89511c
PAF-21 #Forgot to add the adjustments to real file
Philipose Aug 10, 2020
0fcd654
PAF-21 #Adding Exception cases and linting
Philipose Aug 10, 2020
887b429
PAF-21 #Desmelling. Fixing Suppress to allow enum
Philipose Aug 10, 2020
a6be19b
Merge pull request #23 from dynatrace-api-framework/PAF-23
radu-stefan-dt Aug 10, 2020
d59389d
Merge pull request #24 from dynatrace-api-framework/PAF-24
radu-stefan-dt Aug 10, 2020
bc3ee22
Merge branch 'dev' into PAF-22
radu-stefan-dt Aug 10, 2020
58d7b98
Merge pull request #25 from dynatrace-api-framework/PAF-25
radu-stefan-dt Aug 10, 2020
590511d
Merge pull request #21 from dynatrace-api-framework/PAF-22
radu-stefan-dt Aug 10, 2020
92b05d2
PAF-21 #Fixed date assert to look at message
Philipose Aug 10, 2020
27c3770
Adjusting exception to use message
Philipose Aug 10, 2020
646066b
Fixed All Test Cases minus Maintenance
Philipose Aug 10, 2020
578f0c9
PAF-41 #Matching PEP8 Style for constants
Philipose Aug 10, 2020
9532a12
PAF-41 #Renaming for consistancy
Philipose Aug 10, 2020
bba0e31
Merge pull request #27 from dynatrace-api-framework/PAF-41_Fixing_Mer…
radu-stefan-dt Aug 10, 2020
cdeac9c
Merge branch 'PAF-21_Maintenance_Test_Cases' into dev
Philipose Aug 10, 2020
6eded38
Merge pull request #28 from dynatrace-api-framework/dev
Philipose Aug 10, 2020
570d1fa
PAF-21 #Forcing Endpoint to String
Philipose Aug 10, 2020
6ae7f4d
Merge pull request #29 from dynatrace-api-framework/PAF-21_Maintenanc…
Philipose Aug 10, 2020
4016c0d
Merge pull request #30 from dynatrace-api-framework/dev
Philipose Aug 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 2
jobs:
build:
docker:
- image: circleci/python:3.8.3
environment:
PIPENV_VENV_IN_PROJECT: true
- image: mockserver/mockserver
name: mockserver.mockserver
steps:
- checkout # check out source code to working directory
- run:
command: |
sudo chown -R circleci:circleci /usr/local/bin
sudo chown -R circleci:circleci /usr/local/lib/python3.8/site-packages
- run:
command: |
cp .circleci/mockserver.py user_variables.py
pip install pipenv
pipenv install --dev
- run:
command: |
pipenv run python -m unittest discover
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
destination: tr1
42 changes: 42 additions & 0 deletions .circleci/mockserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""User variables to use toolkit for Dynatrace"""
FULL_SET = {
"mockserver1": {
"url": "mockserver:1080",
"tenant": {
"tenant1": "mockserver",
},
"api_token": {
"tenant1": "sample_api_token",
},
"verify_ssl": False,
"is_managed": False,
"cluster_token": "Required for Cluster Operations in Managed"
}
}

LOG_LEVEL="INFO"

# ROLE TYPE KEYS
# access_env
# change_settings
# install_agent
# view_logs
# view_senstive
# change_sensitive

USER_GROUPS = {
"role_types": {
"access_env": "accessenv",
"change_settings": "changesettings",
"view_logs": "logviewer",
"view_sensitive": "viewsensitive"
},
"role_tenants": [
"nonprod",
"prod"
]
}

USER_GROUP_TEMPLATE = "prefix_{USER_TYPE}_{TENANT}_{APP_NAME}_suffix"

DEFAULT_TIMEZONE = "America/Chicago"
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
omit =
# omit anything in a .local directory anywhere
*/.local/*
# omit everything in /usr
/usr/*
# omit in the test tools
tests/*
user_variables.py
51 changes: 51 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore: [master]
# Remove the line above to run when pushing to master
pull_request:
branches: [master, test, dev]

###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: docker://github/super-linter:v3
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ variable_sets/*
scripts/*
templates/*

.vscode/
# Workspace settings and virtual environments
**.vscode**
**venv**
# Framework log files
***.log**

user_variables.py
sandbox_script.py
Expand Down
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
init-hook='from sys.path import append; from os import getcwd; append(getcwd())'
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ verify_ssl = true
[dev-packages]
pylint = "*"
autopep8 = "*"
coverage = "*"

[packages]
requests = "*"

[requires]
python_version = "3.4"
python_version = "3.8"
72 changes: 56 additions & 16 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 20 additions & 15 deletions change_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
import argparse
import os


def replace_set(set_file):
"""Replace Variable File"""
# Options are Darwin, Linux, Java and Windows. Java not supported
if "Windows" in system():
os.system("copy variable_sets\\" + str(set_file) + ".py user_variables.py")
else:
os.system("cp variable_sets/" + str(set_file) + ".py user_variables.py")
"""Replace Variable File"""
# Options are Darwin, Linux, Java and Windows. Java not supported
if "Windows" in system():
os.system("copy variable_sets\\" +
str(set_file) + ".py user_variables.py")
else:
os.system("cp variable_sets/" + str(set_file) +
".py user_variables.py")


def get_variable_set_file(variable_set_arg):
"""Checks if the set file was provided via arg else prompt"""
if variable_set_arg:
return variable_set_arg
return input("Enter Set to Import: ")
"""Checks if the set file was provided via arg else prompt"""
if variable_set_arg:
return variable_set_arg
return input("Enter Set to Import: ")


if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--set-file', '-s')
args = parser.parse_args()
set_file = get_variable_set_file(args.set_file)
replace_set(set_file)
parser = argparse.ArgumentParser()
parser.add_argument('--set-file', '-s')
args = parser.parse_args()
set_file = get_variable_set_file(args.set_file)
replace_set(set_file)
20 changes: 14 additions & 6 deletions dynatrace/cluster/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import dynatrace.requests.request_handler as rh


def get_node_info(cluster):
response = rh.cluster_get(cluster,"cluster")
return response.json()
response = rh.make_api_call(cluster=cluster,
endpoint=rh.ClusterAPIs.CLUSTER)
return response.json()


def get_node_config(cluster):
response = rh.cluster_get(cluster,"cluster/configuration")
return response.json()
response = rh.make_api_call(cluster=cluster,
endpoint=rh.ClusterAPIs.CONFIG)
return response.json()


def set_node_config(cluster, json):
response = rh.cluster_post(cluster,"cluster/configuration", json=json)
return response.status_code
response = rh.make_api_call(cluster=cluster,
endpoint=rh.ClusterAPIs.CONFIG,
method=rh.HTTP.POST,
json=json)
return response.status_code
Loading