Loading app.py +13 −3 Original line number Original line Diff line number Diff line Loading @@ -14,11 +14,14 @@ # This file is an original contribution from Telefonica Innovación Digital S.L. # This file is an original contribution from Telefonica Innovación Digital S.L. import os from flask import Flask from flask import Flask from flask_restx import Api from flask_restx import Api from flask_cors import CORS from flask_cors import CORS from swagger.slice_namespace import slice_ns from swagger.tfs_namespace import tfs_ns from src.Constants import NSC_PORT from swagger.ixia_namespace import ixia_ns from src.Constants import NSC_PORT, WEBUI_DEPLOY from src.webui.gui import gui_bp app = Flask(__name__) app = Flask(__name__) CORS(app) CORS(app) Loading @@ -33,7 +36,14 @@ api = Api( ) ) # Register namespaces # Register namespaces api.add_namespace(slice_ns, path="/slice") api.add_namespace(tfs_ns, path="/tfs") api.add_namespace(ixia_ns, path="/ixia") #gui_bp = Blueprint('gui', __name__, template_folder='templates') if WEBUI_DEPLOY: app.secret_key = 'clave-secreta-dev' app.register_blueprint(gui_bp) if __name__ == "__main__": if __name__ == "__main__": app.run(host="0.0.0.0", port=NSC_PORT, debug=True) app.run(host="0.0.0.0", port=NSC_PORT, debug=True) src/Constants.py +15 −6 Original line number Original line Diff line number Diff line Loading @@ -14,7 +14,8 @@ # This file is an original contribution from Telefonica Innovación Digital S.L. # This file is an original contribution from Telefonica Innovación Digital S.L. import logging, os import logging, os, json # Default logging level # Default logging level DEFAULT_LOGGING_LEVEL = logging.INFO DEFAULT_LOGGING_LEVEL = logging.INFO Loading @@ -24,14 +25,22 @@ NSC_PORT = 8081 # Paths # Paths # Obtain the absolute path of the current file # Obtain the absolute path of the current file SRC_PATH = os.path.dirname(os.path.abspath(__file__)) SRC_PATH = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(SRC_PATH, 'IPs.json')) as f: ips = json.load(f) # Create the path to the desired file relative to the current file # Create the path to the desired file relative to the current file TEMPLATES_PATH = os.path.join(SRC_PATH, "templates") TEMPLATES_PATH = os.path.join(SRC_PATH, "templates") # TFS Flags # Controller Flags # Flag to determine if configurations should be uploaded to Teraflow # If True, config is not sent to controllers TFS_UPLOAD = False DUMMY_MODE = True # Teraflow IP # Teraflow IP TFS_IP = "192.168.165.10" TFS_IP = ips.get('TFS_IP') # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection TFS_L2VPN_SUPPORT = False TFS_L2VPN_SUPPORT = False # IXIA NEII IP IXIA_IP = ips.get('IXIA_IP') # WebUI # Flag to deploy the WebUI WEBUI_DEPLOY = True No newline at end of file src/IPs.json 0 → 100644 +4 −0 Original line number Original line Diff line number Diff line { "TFS_IP": "192.168.27.165", "IXIA_IP": "192.168.27.59" } No newline at end of file Loading
app.py +13 −3 Original line number Original line Diff line number Diff line Loading @@ -14,11 +14,14 @@ # This file is an original contribution from Telefonica Innovación Digital S.L. # This file is an original contribution from Telefonica Innovación Digital S.L. import os from flask import Flask from flask import Flask from flask_restx import Api from flask_restx import Api from flask_cors import CORS from flask_cors import CORS from swagger.slice_namespace import slice_ns from swagger.tfs_namespace import tfs_ns from src.Constants import NSC_PORT from swagger.ixia_namespace import ixia_ns from src.Constants import NSC_PORT, WEBUI_DEPLOY from src.webui.gui import gui_bp app = Flask(__name__) app = Flask(__name__) CORS(app) CORS(app) Loading @@ -33,7 +36,14 @@ api = Api( ) ) # Register namespaces # Register namespaces api.add_namespace(slice_ns, path="/slice") api.add_namespace(tfs_ns, path="/tfs") api.add_namespace(ixia_ns, path="/ixia") #gui_bp = Blueprint('gui', __name__, template_folder='templates') if WEBUI_DEPLOY: app.secret_key = 'clave-secreta-dev' app.register_blueprint(gui_bp) if __name__ == "__main__": if __name__ == "__main__": app.run(host="0.0.0.0", port=NSC_PORT, debug=True) app.run(host="0.0.0.0", port=NSC_PORT, debug=True)
src/Constants.py +15 −6 Original line number Original line Diff line number Diff line Loading @@ -14,7 +14,8 @@ # This file is an original contribution from Telefonica Innovación Digital S.L. # This file is an original contribution from Telefonica Innovación Digital S.L. import logging, os import logging, os, json # Default logging level # Default logging level DEFAULT_LOGGING_LEVEL = logging.INFO DEFAULT_LOGGING_LEVEL = logging.INFO Loading @@ -24,14 +25,22 @@ NSC_PORT = 8081 # Paths # Paths # Obtain the absolute path of the current file # Obtain the absolute path of the current file SRC_PATH = os.path.dirname(os.path.abspath(__file__)) SRC_PATH = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(SRC_PATH, 'IPs.json')) as f: ips = json.load(f) # Create the path to the desired file relative to the current file # Create the path to the desired file relative to the current file TEMPLATES_PATH = os.path.join(SRC_PATH, "templates") TEMPLATES_PATH = os.path.join(SRC_PATH, "templates") # TFS Flags # Controller Flags # Flag to determine if configurations should be uploaded to Teraflow # If True, config is not sent to controllers TFS_UPLOAD = False DUMMY_MODE = True # Teraflow IP # Teraflow IP TFS_IP = "192.168.165.10" TFS_IP = ips.get('TFS_IP') # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection # Flag to determine if additional L2VPN configuration support is required for deploying L2VPNs with path selection TFS_L2VPN_SUPPORT = False TFS_L2VPN_SUPPORT = False # IXIA NEII IP IXIA_IP = ips.get('IXIA_IP') # WebUI # Flag to deploy the WebUI WEBUI_DEPLOY = True No newline at end of file
src/IPs.json 0 → 100644 +4 −0 Original line number Original line Diff line number Diff line { "TFS_IP": "192.168.27.165", "IXIA_IP": "192.168.27.59" } No newline at end of file