Skip to content
Snippets Groups Projects
Commit 49b683db authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Some fixes and removals

parent 43b9cd4c
Branches
Tags
No related merge requests found
......@@ -3,14 +3,13 @@
import logging
import re
from eccs2properties import DAY
from eccs2properties import DAY,ECCS2LOGSDIR
from flask import Flask, request, jsonify
from flask_restful import Resource, Api
from json import dumps, loads
from logging.handlers import RotatingFileHandler
from pathlib import PurePath
app = Flask(__name__)
api = Api(app)
......@@ -163,7 +162,7 @@ class EccsResults(Resource):
if 'date' in request.args:
app.logger.info("'date' parameter inserted")
file_path = "logs/eccs2_"+request.args['date']+".log"
file_path = "%s/eccs2_%s.log" % (ECCS2LOGSDIR,DAY)
date = request.args['date']
if 'pretty' in request.args:
app.logger.info("'pretty' parameter inserted")
......@@ -318,5 +317,5 @@ api.add_resource(EccsResults, '/eccs/eccsresults') # Route_3
if __name__ == '__main__':
app.config['JSON_AS_ASCII'] = False
app.logger = getLogger("logs/eccs2api.log","INFO")
app.logger = getLogger("eccs2api.log", "INFO", ECCS2LOGSDIR)
app.run(port='5002')
......@@ -9,7 +9,7 @@ import re
import requests
from datetime import date
from eccs2properties import ECCS2LOGSDIR, ECCS2RESULTSLOG, ECCS2CHECKSLOG, ECCS2SELENIUMLOGDIR, ECCS2SELENIUMLOGLEVEL, FEDS_BLACKLIST, IDPS_BLACKLIST, ECCS2SELENIUMPAGELOADTIMEOUT, ECCS2SELENIUMSCRIPTTIMEOUT
from eccs2properties import ECCS2LOGSDIR, ECCS2RESULTSLOG, ECCS2CHECKSLOG, ECCS2SELENIUMLOGDIR, FEDS_BLACKLIST, IDPS_BLACKLIST, ECCS2SELENIUMPAGELOADTIMEOUT, ECCS2SELENIUMSCRIPTTIMEOUT, ECCS2SPS
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
......@@ -176,7 +176,7 @@ def checkIdp(idp,sps,eccs2log,eccs2checksLog,driver):
if (result[0] == result[1] == "OK"):
# IdP-DisplayName;IdP-entityID;IdP-RegAuth;IdP-tech-ctc-1,IdP-tech-ctc-2;IdP-supp-ctc-1,IdP-supp-ctc-2;Status;SP-entityID-1;SP-status-1;SP-entityID-2;SP-status-2
eccs2log.info("%s;%s;%s;%s;%s;%s;%s;%s;%s;%s" % (
idp['displayname'].split(';')[1].split('==')[0],
idp['displayname'].replace("'","'").split(';')[1].split('==')[0],
idp['entityID'],
idp['registrationAuthority'],
strTechContacts,
......@@ -188,7 +188,7 @@ def checkIdp(idp,sps,eccs2log,eccs2checksLog,driver):
result[1]))
elif (result[0] == result[1] == "DISABLED"):
eccs2log.info("%s;%s;%s;%s;%s;%s;%s;%s;%s;%s" % (
idp['displayname'].split(';')[1].split('==')[0],
idp['displayname'].replace("'","'").split(';')[1].split('==')[0],
idp['entityID'],
idp['registrationAuthority'],
strTechContacts,
......@@ -203,7 +203,7 @@ def checkIdp(idp,sps,eccs2log,eccs2checksLog,driver):
return
else:
eccs2log.info("%s;%s;%s;%s;%s;%s;%s;%s;%s;%s" % (
idp['displayname'].split(';')[1].split('==')[0],
idp['displayname'].replace("'","'").split(';')[1].split('==')[0],
idp['entityID'],
idp['registrationAuthority'],
strTechContacts,
......@@ -220,7 +220,7 @@ if __name__=="__main__":
eccs2log = getLogger(ECCS2RESULTSLOG, ECCS2LOGSDIR, "INFO")
eccs2checksLog = getLogger(ECCS2CHECKSLOG, ECCS2LOGSDIR, "INFO")
sps = ["https://sp24-test.garr.it/secure", "https://attribute-viewer.aai.switch.ch/eds/"]
sps = ECCS2SPS
parser = argparse.ArgumentParser(description='Checks if the input IdP consumed correctly eduGAIN metadata by accessing two different SPs')
parser.add_argument("idpJson", metavar="idpJson", nargs=1, help="An IdP in Json format")
......@@ -243,7 +243,7 @@ if __name__=="__main__":
#driver = webdriver.Chrome('chromedriver', options=chrome_options)
# For DEBUG only
# For DEBUG only (By default ChromeDriver logs only warnings/errors to stderr. When debugging issues, it is helpful to enable more verbose logging.)
#driver = webdriver.Chrome('chromedriver', options=chrome_options, service_args=['--log-path=%s/%s.log' % (ECCS2SELENIUMLOGDIR, parse_url(idp['entityID'])[2])])
driver = webdriver.Chrome('chromedriver', options=chrome_options, service_args=['--verbose', '--log-path=%s/%s.log' % (ECCS2SELENIUMLOGDIR, parse_url(idp['entityID'])[2])])
......@@ -254,7 +254,7 @@ if __name__=="__main__":
checkIdp(idp,sps,eccs2log,eccs2checksLog,driver)
#driver.delete_all_cookies()
driver.close()
driver.close() # I need to use "close()" or the driver's process remains active
driver.quit()
# Kill process to release resources and to avoid zombies - this reaise an issue
......
......@@ -21,20 +21,15 @@ ECCS2SELENIUMLOGDIR = "%s/selenium-logs" % ECCS2DIR
ECCS2STDOUT = "%s/stdout.log" % ECCS2LOGSDIR
ECCS2STDERR = "%s/stderr.log" % ECCS2LOGSDIR
# Selenium Log Levels
# 0: All (Show all log messages)
# 1: Debug (Show messages with information useful for debugging)
# 2: Info (Show informational messages)
# 3: Warning (Show messages corresponding to non-critical issues)
# 4: Severe (Show messages corresponding to critical issues)
# 5: Off (Show no log messages)
ECCS2SELENIUMLOGLEVEL = 4
# Selenium Timeouts (in seconds)
ECCS2SELENIUMPAGELOADTIMEOUT = 30
ECCS2SELENIUMSCRIPTTIMEOUT = 30
# Number of processes to run in parallel
ECCS2NUMPROCESSES = 30
ECCS2NUMPROCESSES = 20
# The 2 SPs that will be used to test each IdP
ECCS2SPS = ["https://sp24-test.garr.it/secure", "https://attribute-viewer.aai.switch.ch/eds/"]
# Registration Authority of Federations to exclude from the check
FEDS_BLACKLIST = [
......
#!/usr/bin/env python3.8
from datetime import date
day = date.today().isoformat()
ECCS2PATH = "/opt/eccs2"
ECCS2LOGSPATH = "%s/logs" % ECCS2PATH
ECCS2RESULTSLOG = "eccs2_%s.log" % day
ECCS2CHECKSLOG = "eccs2checks_%s.log" % day
ECCS2SELENIUMLOG = "%s/selenium_chromedriver.log" % ECCS2LOGSPATH
ECCS2STDOUT = "%s/stdout.log" % ECCS2LOGSPATH
ECCS2STDERR = "%s/stderr.log" % ECCS2LOGSPATH
ECCS2NUMPROCESSES = 20
FEDS_BLACKLIST = [
'<REGISTRATION-AUTHORITY-1>',
'<REGISTRATION-AUTHORITY-2>',
'<REGISTRATION-AUTHORITY-3>',
]
IDPS_BLACKLIST = [
'<ENTITYID-IDP-1>',
'<ENTITYID-IDP-2>',
'<ENTITYID-IDP-3>',
]
This diff is collapsed.
This diff is collapsed.
......@@ -53,8 +53,13 @@ $(document).ready(function() {
"data": "contacts.technical",
"defaultContent": ""
},
{ "data": "date" },
{ "data": "status" }
{ "data": "date",
"width": "180px",
"className": "dt-body-center"
},
{ "data": "status",
"className": "dt-body-center"
}
],
"rowCallback": function( row, data, index ) {
if (data.status == "ERROR") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment