class TransportPCEFulltesting(unittest.TestCase):
headers = {'content-type': 'application/json'}
odl_process = None
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
restconf_baseurl = "http://localhost:8181/restconf"
WAITING = 20 # nominal value is 300
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_full_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma-full')
time.sleep(20)
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmc_full_honeynode()
+ cls.sim_process3 = test_utils.start_sim('roadmc-full')
time.sleep(20)
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
+ cls.sim_process4 = test_utils.start_sim('xpdrc')
time.sleep(20)
- print("all honeynodes started")
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(80)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
print("all processes killed")
def setUp(self): # instruction executed before each test method
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17834",
+ "netconf-node-topology:port": test_utils.sims['xpdrc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17821",
+ "netconf-node-topology:port": test_utils.sims['roadma-full']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17823",
+ "netconf-node-topology:port": test_utils.sims['roadmc-full']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
@classmethod
def setUpClass(cls):
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(30)
print("opendaylight started")
class TransportOlmTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_full_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma-full')
time.sleep(20)
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmc_full_honeynode()
+ cls.sim_process3 = test_utils.start_sim('roadmc-full')
time.sleep(20)
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
+ cls.sim_process4 = test_utils.start_sim('xpdrc')
time.sleep(20)
- print("all honeynodes started")
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17834",
+ "netconf-node-topology:port": test_utils.sims['xpdrc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17821",
+ "netconf-node-topology:port": test_utils.sims['roadma-full']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17823",
+ "netconf-node-topology:port": test_utils.sims['roadmc-full']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
@classmethod
def setUpClass(cls): # a class method called before tests in an individual class run.
cls._get_file()
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(90)
print("opendaylight started")
class TransportPCEPortMappingTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma')
time.sleep(20)
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17831",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCERendererTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma')
time.sleep(20)
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17831",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCEtesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma')
time.sleep(20)
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
time.sleep(10)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17831",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCETopologyTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
time.sleep(20)
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma')
time.sleep(20)
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmb_honeynode()
+ cls.sim_process3 = test_utils.start_sim('roadmb')
time.sleep(20)
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_roadmc_honeynode()
+ cls.sim_process4 = test_utils.start_sim('roadmc')
time.sleep(20)
- print("all honeynodes started")
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
def setUp(self):
time.sleep(5)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17831",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17830",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17833",
+ "netconf-node-topology:port": test_utils.sims['roadmc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17832",
+ "netconf-node-topology:port": test_utils.sims['roadmb']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
+#!/usr/bin/env python
+##############################################################################
+# Copyright (c) 2020 Orange, Inc. and others. All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
import os
import subprocess
+sims = {
+ 'xpdra': {'port': '17830', 'configfile': 'oper-XPDRA.xml'},
+ 'roadma': {'port': '17831', 'configfile': 'oper-ROADMA.xml'},
+ 'roadmb': {'port': '17832', 'configfile': 'oper-ROADMB.xml'},
+ 'roadmc': {'port': '17833', 'configfile': 'oper-ROADMC.xml'},
+ 'xpdrc': {'port': '17834', 'configfile': 'oper-XPDRC.xml'},
+ 'roadma-full': {'port': '17821', 'configfile': 'oper-ROADMA-full.xml'},
+ 'roadmc-full': {'port': '17823', 'configfile': 'oper-ROADMC-full.xml'}
+}
+
honeynode_executable = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"..", "..", "honeynode", "1.2.1", "honeynode-simulator", "honeycomb-tpce")
"..", "..", "sample_configs", "openroadm", "1.2.1")
-def start_xpdra_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode1.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17830", os.path.join(samples_directory, "oper-XPDRA.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_roadma_full_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode2.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17821", os.path.join(samples_directory, "oper-ROADMA-full.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_roadma_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode2.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17831", os.path.join(samples_directory, "oper-ROADMA.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_roadmb_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode3.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17832", os.path.join(samples_directory, "oper-ROADMB.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_roadmc_full_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode3.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17823", os.path.join(samples_directory, "oper-ROADMC-full.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_roadmc_honeynode():
- if os.path.isfile(honeynode_executable):
- with open('honeynode4.log', 'w') as outfile:
- return subprocess.Popen(
- [honeynode_executable, "17833", os.path.join(samples_directory, "oper-ROADMC.xml")],
- stdout=outfile, stderr=outfile)
-
-
-def start_xpdrc_honeynode():
+def start_sim(sim):
+ print("starting simulator for " + sim + "...")
if os.path.isfile(honeynode_executable):
- with open('honeynode4.log', 'w') as outfile:
+ with open(sim+'.log', 'w') as outfile:
return subprocess.Popen(
- [honeynode_executable, "17834", os.path.join(samples_directory, "oper-XPDRC.xml")],
+ [honeynode_executable, sims[sim]['port'], os.path.join(samples_directory, sims[sim]['configfile'])],
stdout=outfile, stderr=outfile)
def start_tpce():
+ print("starting opendaylight...")
if "USE_LIGHTY" in os.environ and os.environ['USE_LIGHTY'] == 'True':
print("starting LIGHTY.IO TransportPCE build...")
executable = os.path.join(
"clean-start-controller.sh")
with open('odl.log', 'w') as outfile:
return subprocess.Popen(
- ["sh", executable], stdout=outfile, stderr=outfile,
- stdin=open(os.devnull))
+ ["sh", executable], stdout=outfile, stderr=outfile, stdin=None)
else:
print("starting KARAF TransportPCE build...")
executable = os.path.join(
"..", "..", "..", "karaf", "target", "assembly", "bin", "karaf")
with open('odl.log', 'w') as outfile:
return subprocess.Popen(
- ["sh", executable, "server"], stdout=outfile, stderr=outfile,
- stdin=open(os.devnull))
+ ["sh", executable, "server"], stdout=outfile, stderr=outfile, stdin=None)
class TransportPCEFulltesting(unittest.TestCase):
odl_process = None
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
restconf_baseurl = "http://localhost:8181/restconf"
WAITING = 20 # nominal value is 300
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
+ cls.sim_process2 = test_utils.start_sim('roadma')
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmc_honeynode()
- time.sleep(20)
+ cls.sim_process3 = test_utils.start_sim('roadmc')
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
- time.sleep(20)
- print("all honeynodes started")
+ cls.sim_process4 = test_utils.start_sim('xpdrc')
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(80)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
print("all processes killed")
def setUp(self): # instruction executed before each test method
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17844",
+ "netconf-node-topology:port": test_utils.sims['xpdrc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17843",
+ "netconf-node-topology:port": test_utils.sims['roadmc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportOlmTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
+ cls.sim_process2 = test_utils.start_sim('roadma')
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmc_honeynode()
- time.sleep(20)
+ cls.sim_process3 = test_utils.start_sim('roadmc')
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
- time.sleep(20)
+ cls.sim_process4 = test_utils.start_sim('xpdrc')
- print("all honeynodes started")
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17844",
+ "netconf-node-topology:port": test_utils.sims['xpdrc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17843",
+ "netconf-node-topology:port": test_utils.sims['roadmc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCEtesting(unittest.TestCase):
- honeynode_process1 = None
+ sim_process1 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_spdra_honeynode()
- time.sleep(30)
+ cls.sim_process1 = test_utils.start_sim('spdrav2')
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
def setUp(self):
time.sleep(5)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17845",
+ "netconf-node-topology:port": test_utils.sims['spdrav2']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCEtesting(unittest.TestCase):
- honeynode_process1 = None
+ sim_process1 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_spdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('spdrav2')
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
def setUp(self):
time.sleep(5)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17845",
+ "netconf-node-topology:port": test_utils.sims['spdrav2']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCEPortMappingTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
- print("all honeynodes started")
+ cls.sim_process2 = test_utils.start_sim('roadma')
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCERendererTesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
- print("all honeynodes started")
+ cls.sim_process2 = test_utils.start_sim('roadma')
+ print("all sims started")
print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
print("execution of {}".format(self.id().split(".")[-1]))
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportTapitesting(unittest.TestCase):
odl_process = None
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
- honeynode_process5 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
+ sim_process5 = None
# START_IGNORE_XTESTING
def setUpClass(cls):
cls.init_failed = False
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True':
karaf_log = os.path.join(
found = test_utils.wait_until_log_contains(karaf_log, searched_expr, time_to_wait=60)
cls.init_failed = not found
if not cls.init_failed:
- print("starting XPDRA...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting ROADMA...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+ cls.sim_process2 = test_utils.start_sim('roadma')
- print("starting ROADMC...")
- cls.honeynode_process3 = test_utils.start_roadmc_honeynode()
+ cls.sim_process3 = test_utils.start_sim('roadmc')
- print("starting XPDRC...")
- cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
+ cls.sim_process4 = test_utils.start_sim('xpdrc')
- print("starting SPDRA...")
- cls.honeynode_process5 = test_utils.start_spdra_honeynode()
- print("all honeynodes started")
+ cls.sim_process5 = test_utils.start_sim('spdrav2')
+ print("all sims started")
@classmethod
def tearDownClass(cls):
test_utils.shutdown_process(cls.odl_process)
- test_utils.shutdown_process(cls.honeynode_process1)
- test_utils.shutdown_process(cls.honeynode_process2)
- test_utils.shutdown_process(cls.honeynode_process3)
- test_utils.shutdown_process(cls.honeynode_process4)
- test_utils.shutdown_process(cls.honeynode_process5)
+ test_utils.shutdown_process(cls.sim_process1)
+ test_utils.shutdown_process(cls.sim_process2)
+ test_utils.shutdown_process(cls.sim_process3)
+ test_utils.shutdown_process(cls.sim_process4)
+ test_utils.shutdown_process(cls.sim_process5)
print("all processes killed")
def setUp(self): # instruction executed before each test method
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/SPDR-SA1"
.format(RESTCONF_BASE_URL))
- data = test_utils.generate_connect_data("SPDR-SA1", "17845")
+ data = test_utils.generate_connect_data("SPDR-SA1", test_utils.sims['spdrav2']['port'])
response = test_utils.put_request(url, data, 'admin', 'admin')
self.assertEqual(response.status_code, requests.codes.created, CODE_SHOULD_BE_201) # pylint: disable=no-member
time.sleep(10)
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/XPDR-A1"
.format(RESTCONF_BASE_URL))
- data = test_utils.generate_connect_data("XPDR-A1", "17840")
+ data = test_utils.generate_connect_data("XPDR-A1", test_utils.sims['xpdra']['port'])
response = test_utils.put_request(url, data, 'admin', 'admin')
self.assertEqual(response.status_code, requests.codes.created, CODE_SHOULD_BE_201) # pylint: disable=no-member
time.sleep(10)
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/XPDR-C1"
.format(RESTCONF_BASE_URL))
- data = test_utils.generate_connect_data("XPDR-C1", "17844")
+ data = test_utils.generate_connect_data("XPDR-C1", test_utils.sims['xpdrc']['port'])
response = test_utils.put_request(url, data, 'admin', 'admin')
self.assertEqual(response.status_code, requests.codes.created, CODE_SHOULD_BE_201) # pylint: disable=no-member
time.sleep(10)
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/ROADM-A1"
.format(RESTCONF_BASE_URL))
- data = test_utils.generate_connect_data("ROADM-A1", "17841")
+ data = test_utils.generate_connect_data("ROADM-A1", test_utils.sims['roadma']['port'])
response = test_utils.put_request(url, data, 'admin', 'admin')
self.assertEqual(response.status_code, requests.codes.created, CODE_SHOULD_BE_201) # pylint: disable=no-member
time.sleep(20)
url = ("{}/config/network-topology:"
"network-topology/topology/topology-netconf/node/ROADM-C1"
.format(RESTCONF_BASE_URL))
- data = test_utils.generate_connect_data("ROADM-C1", "17843")
+ data = test_utils.generate_connect_data("ROADM-C1", test_utils.sims['roadmc']['port'])
response = test_utils.put_request(url, data, 'admin', 'admin')
self.assertEqual(response.status_code, requests.codes.created, CODE_SHOULD_BE_201) # pylint: disable=no-member
time.sleep(20)
class TransportPCEtesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
+ sim_process1 = None
+ sim_process2 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
- print("all honeynodes started")
+ cls.sim_process2 = test_utils.start_sim('roadma')
+ print("all sims started")
- print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
time.sleep(60)
print("opendaylight started")
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
def setUp(self):
time.sleep(10)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
class TransportPCEtesting(unittest.TestCase):
- honeynode_process1 = None
- honeynode_process2 = None
- honeynode_process3 = None
- honeynode_process4 = None
+ sim_process1 = None
+ sim_process2 = None
+ sim_process3 = None
+ sim_process4 = None
odl_process = None
restconf_baseurl = "http://localhost:8181/restconf"
@classmethod
def setUpClass(cls):
- print("starting honeynode1...")
- cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
- time.sleep(20)
+ cls.sim_process1 = test_utils.start_sim('xpdra')
- print("starting honeynode2...")
- cls.honeynode_process2 = test_utils.start_roadma_honeynode()
- time.sleep(20)
+ cls.sim_process2 = test_utils.start_sim('roadma')
- print("starting honeynode3...")
- cls.honeynode_process3 = test_utils.start_roadmb_honeynode()
- time.sleep(20)
+ cls.sim_process3 = test_utils.start_sim('roadmb')
- print("starting honeynode4...")
- cls.honeynode_process4 = test_utils.start_roadmc_honeynode()
- time.sleep(20)
- print("all honeynodes started")
+ cls.sim_process4 = test_utils.start_sim('roadmc')
+ print("all sims started")
print("starting opendaylight...")
cls.odl_process = test_utils.start_tpce()
child.wait()
cls.odl_process.send_signal(signal.SIGINT)
cls.odl_process.wait()
- for child in psutil.Process(cls.honeynode_process1.pid).children():
+ for child in psutil.Process(cls.sim_process1.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process1.send_signal(signal.SIGINT)
- cls.honeynode_process1.wait()
- for child in psutil.Process(cls.honeynode_process2.pid).children():
+ cls.sim_process1.send_signal(signal.SIGINT)
+ cls.sim_process1.wait()
+ for child in psutil.Process(cls.sim_process2.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process2.send_signal(signal.SIGINT)
- cls.honeynode_process2.wait()
- for child in psutil.Process(cls.honeynode_process3.pid).children():
+ cls.sim_process2.send_signal(signal.SIGINT)
+ cls.sim_process2.wait()
+ for child in psutil.Process(cls.sim_process3.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process3.send_signal(signal.SIGINT)
- cls.honeynode_process3.wait()
- for child in psutil.Process(cls.honeynode_process4.pid).children():
+ cls.sim_process3.send_signal(signal.SIGINT)
+ cls.sim_process3.wait()
+ for child in psutil.Process(cls.sim_process4.pid).children():
child.send_signal(signal.SIGINT)
child.wait()
- cls.honeynode_process4.send_signal(signal.SIGINT)
- cls.honeynode_process4.wait()
+ cls.sim_process4.send_signal(signal.SIGINT)
+ cls.sim_process4.wait()
def setUp(self):
time.sleep(5)
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17841",
+ "netconf-node-topology:port": test_utils.sims['roadma']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17840",
+ "netconf-node-topology:port": test_utils.sims['xpdra']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17843",
+ "netconf-node-topology:port": test_utils.sims['roadmc']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
"netconf-node-topology:username": "admin",
"netconf-node-topology:password": "admin",
"netconf-node-topology:host": "127.0.0.1",
- "netconf-node-topology:port": "17842",
+ "netconf-node-topology:port": test_utils.sims['roadmb']['port'],
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:pass-through": {}}]}
headers = {'content-type': 'application/json'}
import psutil
import requests
+sims = {
+ 'xpdra': {'port': '17840', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'},
+ 'roadma': {'port': '17841', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'},
+ 'roadmb': {'port': '17842', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'},
+ 'roadmc': {'port': '17843', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'},
+ 'xpdrc': {'port': '17844', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'},
+ 'spdrav2': {'port': '17845', 'configfile': 'oper-SPDRAv2.xml', 'logfile': 'oper-SPDRAv2.log'},
+ 'spdrav1': {'port': '17846', 'configfile': 'oper-SPDRAv1.xml', 'logfile': 'oper-SPDRAv1.log'}
+}
+
HONEYNODE_OK_START_MSG = re.escape("Netconf SSH endpoint started successfully at 0.0.0.0")
TYPE_APPLICATION_JSON = {'content-type': 'application/json'}
log_directory = os.path.dirname(os.path.realpath(__file__))
-def start_xpdra_honeynode():
- log_file = os.path.join(log_directory, "oper-XPDRA.log")
- process = start_node(log_file, "17840", "oper-XPDRA.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
- return process
-
-
-def start_roadma_honeynode():
- log_file = os.path.join(log_directory, "oper-ROADMA.log")
- process = start_node(log_file, "17841", "oper-ROADMA.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
- return process
-
-
-def start_roadmb_honeynode():
- log_file = os.path.join(log_directory, "oper-ROADMB.log")
- process = start_node(log_file, "17842", "oper-ROADMB.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
- return process
-
-
-def start_roadmc_honeynode():
- log_file = os.path.join(log_directory, "oper-ROADMC.log")
- process = start_node(log_file, "17843", "oper-ROADMC.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
- return process
-
-
-def start_xpdrc_honeynode():
- log_file = os.path.join(log_directory, "oper-XPDRC.log")
- process = start_node(log_file, "17844", "oper-XPDRC.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
- return process
-
-
-def start_spdra_honeynode():
- log_file = os.path.join(log_directory, "oper-SPDRAv2.log")
- process = start_node(log_file, "17845", "oper-SPDRAv2.xml")
- wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000)
+def start_sim(sim):
+ print("starting simulator for " + sim + "...")
+ log_file = os.path.join(log_directory, sims[sim]['logfile'])
+ process = start_node(log_file, sims[sim]['port'], sims[sim]['configfile'])
+ if wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 5000):
+ print("simulator for " + sim + " started")
+ else:
+ print("simulator for " + sim + "failed to start")
return process
def start_tpce():
+ print("starting opendaylight...")
if "USE_LIGHTY" in os.environ and os.environ['USE_LIGHTY'] == 'True':
print("starting LIGHTY.IO TransportPCE build...")
executable = os.path.join(
"clean-start-controller.sh")
with open('odl.log', 'w') as outfile:
return subprocess.Popen(
- ["sh", executable], stdout=outfile, stderr=outfile,
- stdin=open(os.devnull))
+ ["sh", executable], stdout=outfile, stderr=outfile, stdin=None)
else:
print("starting KARAF TransportPCE build...")
executable = os.path.join(
"..", "..", "..", "karaf", "target", "assembly", "bin", "karaf")
with open('odl.log', 'w') as outfile:
return subprocess.Popen(
- ["sh", executable, "server"], stdout=outfile, stderr=outfile,
- stdin=open(os.devnull))
+ ["sh", executable, "server"], stdout=outfile, stderr=outfile, stdin=None)
def install_karaf_feature(feature_name: str):