Remove all useless scapy WARNING: on import from scapy
Just delay a whee bit in SSH agent before closing channel/session.
For some reason, there seems to be unread data in the tcp queue.
When closed quickly ends up RST'ing the tcp/onos-karaf server side session.
This causes a bogus "Connection reset by peer" exception in the ONOS log for every cli session established to ONOS from cord-tester
Change-Id: I954429b7d132d89b0f0515b267468bf4127ac127
diff --git a/src/test/acl/__init__.py b/src/test/acl/__init__.py
index c38f621..8703945 100644
--- a/src/test/acl/__init__.py
+++ b/src/test/acl/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/cli/__init__.py b/src/test/cli/__init__.py
index 2864a46..4344dce 100644
--- a/src/test/cli/__init__.py
+++ b/src/test/cli/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/cluster/__init__.py b/src/test/cluster/__init__.py
index c38f621..8703945 100644
--- a/src/test/cluster/__init__.py
+++ b/src/test/cluster/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/cordSubscriber/__init__.py b/src/test/cordSubscriber/__init__.py
index db4ad9c..b2581e2 100644
--- a/src/test/cordSubscriber/__init__.py
+++ b/src/test/cordSubscriber/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/cordvtn/__init__.py b/src/test/cordvtn/__init__.py
index fd839d6..9bd586d 100644
--- a/src/test/cordvtn/__init__.py
+++ b/src/test/cordvtn/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/dhcp/__init__.py b/src/test/dhcp/__init__.py
index 58368ab..b2581e2 100644
--- a/src/test/dhcp/__init__.py
+++ b/src/test/dhcp/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/dhcprelay/__init__.py b/src/test/dhcprelay/__init__.py
index 58368ab..b2581e2 100644
--- a/src/test/dhcprelay/__init__.py
+++ b/src/test/dhcprelay/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/fabric/__init__.py b/src/test/fabric/__init__.py
index dce9397..9bd586d 100644
--- a/src/test/fabric/__init__.py
+++ b/src/test/fabric/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/flows/__init__.py b/src/test/flows/__init__.py
index dce9397..9bd586d 100644
--- a/src/test/flows/__init__.py
+++ b/src/test/flows/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/igmp/__init__.py b/src/test/igmp/__init__.py
index db4ad9c..b2581e2 100644
--- a/src/test/igmp/__init__.py
+++ b/src/test/igmp/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/iperf/__init__.py b/src/test/iperf/__init__.py
index a10dac0..7926c81 100644
--- a/src/test/iperf/__init__.py
+++ b/src/test/iperf/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
@@ -24,4 +26,3 @@
__path__.append(fsm_dir)
__path__.append(cli_dir)
__path__.append(subscriber_dir)
-
diff --git a/src/test/ipv6vrouter/__init__.py b/src/test/ipv6vrouter/__init__.py
index c38f621..8703945 100644
--- a/src/test/ipv6vrouter/__init__.py
+++ b/src/test/ipv6vrouter/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/md5/__init__.py b/src/test/md5/__init__.py
index dce9397..9bd586d 100644
--- a/src/test/md5/__init__.py
+++ b/src/test/md5/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/mini/__init__.py b/src/test/mini/__init__.py
index 58368ab..b2581e2 100644
--- a/src/test/mini/__init__.py
+++ b/src/test/mini/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/monitoring/__init__.py b/src/test/monitoring/__init__.py
index 58368ab..b2581e2 100644
--- a/src/test/monitoring/__init__.py
+++ b/src/test/monitoring/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/netCondition/__init__.py b/src/test/netCondition/__init__.py
index db4ad9c..b2581e2 100644
--- a/src/test/netCondition/__init__.py
+++ b/src/test/netCondition/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/onosCli/__init__.py b/src/test/onosCli/__init__.py
index 4ce6893..5028a6f 100644
--- a/src/test/onosCli/__init__.py
+++ b/src/test/onosCli/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/pap/__init__.py b/src/test/pap/__init__.py
index dce9397..9bd586d 100644
--- a/src/test/pap/__init__.py
+++ b/src/test/pap/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/proxyarp/__init__.py b/src/test/proxyarp/__init__.py
index c38f621..8703945 100644
--- a/src/test/proxyarp/__init__.py
+++ b/src/test/proxyarp/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/subscriber/__init__.py b/src/test/subscriber/__init__.py
index dce9397..9bd586d 100644
--- a/src/test/subscriber/__init__.py
+++ b/src/test/subscriber/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/tls/__init__.py b/src/test/tls/__init__.py
index 3d1f997..9bd586d 100644
--- a/src/test/tls/__init__.py
+++ b/src/test/tls/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
@@ -22,5 +24,3 @@
__path__.append(fsm_dir)
cli_dir = os.path.join(working_dir, '../cli')
__path__.append(cli_dir)
-
-
diff --git a/src/test/utils/ACL.py b/src/test/utils/ACL.py
index b246de1..ecb159e 100644
--- a/src/test/utils/ACL.py
+++ b/src/test/utils/ACL.py
@@ -16,6 +16,8 @@
import json
import requests
import os,sys,time
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
from CordTestUtils import get_mac, get_controller
from OnosCtrl import OnosCtrl
diff --git a/src/test/utils/Channels.py b/src/test/utils/Channels.py
index 71cda6a..8266c7e 100644
--- a/src/test/utils/Channels.py
+++ b/src/test/utils/Channels.py
@@ -19,6 +19,8 @@
import time
import monotonic
import random
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
from McastTraffic import *
from IGMP import *
diff --git a/src/test/utils/Cluster.py b/src/test/utils/Cluster.py
index c42ea64..31b6bbb 100644
--- a/src/test/utils/Cluster.py
+++ b/src/test/utils/Cluster.py
@@ -23,6 +23,8 @@
from socket import socket
import pexpect
from Stats import Stats
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
from OnosFlowCtrl import OnosFlowCtrl
from nose.twistedtools import reactor, deferred
diff --git a/src/test/utils/CordLogger.py b/src/test/utils/CordLogger.py
index e58e4ff..cbebee5 100644
--- a/src/test/utils/CordLogger.py
+++ b/src/test/utils/CordLogger.py
@@ -1,4 +1,6 @@
from OnosLog import OnosLog
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import log
from onosclidriver import OnosCliDriver
from OnosCtrl import OnosCtrl
@@ -9,6 +11,7 @@
import unittest
import os
import time
+import warnings
def get_controller_names(controllers):
controller_names = [ 'cord-onos' if controllers.index(c) == 0 else 'cord-onos-{}'.format(controllers.index(c)+1) for c in controllers ]
@@ -31,6 +34,10 @@
archive_dir = os.path.join(setup_dir, 'test_logs')
onos_data_dir = os.path.join(setup_dir, 'cord-onos-data')
+ def __init__(self, *args, **kwargs):
+ warnings.simplefilter('ignore')
+ super(CordLogger, self).__init__(*args, **kwargs)
+
@classmethod
def cliSessionEnter(cls):
try:
diff --git a/src/test/utils/OnosFlowCtrl.py b/src/test/utils/OnosFlowCtrl.py
index 844bc3c..8ccc095 100644
--- a/src/test/utils/OnosFlowCtrl.py
+++ b/src/test/utils/OnosFlowCtrl.py
@@ -17,6 +17,8 @@
import requests
import os,sys,time
from nose.tools import *
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
from OnosCtrl import OnosCtrl, get_controller
@@ -304,4 +306,3 @@
log.error('Flow post request returned with status %d' %response.status_code)
return False
-
diff --git a/src/test/utils/SSHTestAgent.py b/src/test/utils/SSHTestAgent.py
index 1f6a6d0..e5930bf 100644
--- a/src/test/utils/SSHTestAgent.py
+++ b/src/test/utils/SSHTestAgent.py
@@ -1,5 +1,7 @@
-import os, sys
+import os, sys, time
from paramiko import SSHClient, WarningPolicy, AutoAddPolicy
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
from scapy.all import *
class SSHTestAgent(object):
@@ -47,6 +49,7 @@
output += data
else:
break
+ time.sleep(0.1)
channel.close()
self.client.close()
return st, output
diff --git a/src/test/vrouter/__init__.py b/src/test/vrouter/__init__.py
index b6ae4a3..8703945 100644
--- a/src/test/vrouter/__init__.py
+++ b/src/test/vrouter/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/vsg/__init__.py b/src/test/vsg/__init__.py
index db4ad9c..b2581e2 100644
--- a/src/test/vsg/__init__.py
+++ b/src/test/vsg/__init__.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')
diff --git a/src/test/vsg/vsgTest.py b/src/test/vsg/vsgTest.py
index de59966..5ad8d3e 100644
--- a/src/test/vsg/vsgTest.py
+++ b/src/test/vsg/vsgTest.py
@@ -14,7 +14,6 @@
#
import time
import os
-import warnings
from nose.tools import *
from scapy.all import *
from CordTestUtils import *
@@ -41,7 +40,6 @@
@classmethod
def setUpClass(cls):
- warnings.simplefilter('ignore')
cls.controllers = get_controllers()
cls.controller = cls.controllers[0]
cls.cli = None
diff --git a/src/test/xos/__init__.py b/src/test/xos/__init__.py
index c38f621..8703945 100644
--- a/src/test/xos/__init__.py
+++ b/src/test/xos/__init__.py
@@ -14,6 +14,8 @@
# limitations under the License.
#
import os,sys
+import logging
+logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
##add the python path to lookup the utils
working_dir = os.path.dirname(os.path.realpath(sys.argv[-1]))
utils_dir = os.path.join(working_dir, '../utils')