Merge "[SDFAB-607] Move INT TestON tests to a different dir"
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/INT.params b/TestON/tests/USECASE/SegmentRouting/INT/INT.params
new file mode 100644
index 0000000..b4be343
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/INT.params
@@ -0,0 +1,6 @@
+<!-- SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation. -->
+<!-- SPDX-License-Identifier: GPL-2.0-or-later -->
+<PARAMS>
+ <testcases>1,2,3</testcases>
+ <routerMac>00:00:0A:4C:1C:46</routerMac>
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/INT.py b/TestON/tests/USECASE/SegmentRouting/INT/INT.py
new file mode 100644
index 0000000..c902af3
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/INT.py
@@ -0,0 +1,223 @@
+# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+class INT:
+
+ def __init__(self):
+ self.default = ""
+
+ def CASE1 (self, main):
+ """
+ Send ping packets from one host to another host and check flows from DeepInsight.
+ """
+ import time
+ import socket
+ from core import utilities
+ from tests.USECASE.SegmentRouting.INT.dependencies.IntTest import IntTest
+ main.cfgName = "CASE1"
+
+ main.step("Setting up the test")
+ intTest = IntTest(scapy=True)
+ intTest.setUpTest(main)
+
+ main.step("Setting up hosts and variables")
+ srcIfaceName = main.h1.interfaces[0]["name"]
+ dstIfaceName = main.h2.interfaces[0]["name"]
+ srcMac = main.h1.getMac(srcIfaceName)
+ dstMac = main.h2.getMac(dstIfaceName)
+ srcIp = main.h1.getIp(srcIfaceName)
+ dstIp = main.h2.getIp(dstIfaceName)
+ srcPort = 2000
+ dstPort = 8888
+
+ main.step("Send ping packets from h1 to h2")
+ startTimeMs = (time.time() - 5) * 1000
+ pkt = """(
+ Ether(src="{}", dst="{}") /
+ IP(src="{}", dst="{}") /
+ UDP(sport={}, dport={}) /
+ ("A"*30)
+ )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
+ main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+ endTimeMs = (time.time() + 5) * 1000
+
+ main.step("Checking total number of flow reports from DeepInsight")
+ def getFiveTupleCount(*args, **kwargs):
+ flows = main.DeepInsight.getFlows(
+ startTimeMs=startTimeMs,
+ endTimeMs=endTimeMs,
+ srcIp=srcIp,
+ dstIp=dstIp,
+ ipProto=socket.IPPROTO_UDP
+ )
+ if "FiveTupleCount" in flows:
+ return flows["FiveTupleCount"]
+ else:
+ return 0
+ # Need to wait few seconds until DeepInsight database updated.
+ fiveTupleCount = utilities.retry(
+ f=getFiveTupleCount,
+ retValue=0,
+ attempts=60,
+ )
+
+ utilities.assert_equals(
+ expect=1, actual=fiveTupleCount,
+ onpass="Got 1 flow report from DeepInsight as expected.",
+ onfail="Got %d flow reports from DeepInsight (expect 1)" % (fiveTupleCount)
+ )
+
+ main.step("Clean up the test")
+ intTest.cleanUp(main)
+
+ def CASE2 (self, main):
+ """
+ Send a packet with invalid VLAN from one host to another host and check
+ if DeepInsight receives drop reports.
+ """
+ import time
+ import socket
+ from core import utilities
+ from tests.USECASE.SegmentRouting.INT.dependencies.IntTest import IntTest
+ main.cfgName = "CASE2"
+
+ main.step("Setting up the test")
+ intTest = IntTest(scapy=True)
+ intTest.setUpTest(main)
+
+ main.step("Setting up hosts and variables")
+ srcIfaceName = main.h1.interfaces[0]["name"]
+ dstIfaceName = main.h2.interfaces[0]["name"]
+ srcMac = main.h1.getMac(srcIfaceName)
+ dstMac = main.h2.getMac(dstIfaceName)
+ srcIp = main.h1.getIp(srcIfaceName)
+ dstIp = main.h2.getIp(dstIfaceName)
+ srcPort = 2000
+ dstPort = 8888
+
+ main.step("Sending a packet with invalid VLAN ID from h1")
+ startTimeMs = (time.time() - 5) * 1000
+ pkt = """(
+ Ether(src="{}", dst="{}") /
+ Dot1Q(vlan=4093) /
+ IP(src="{}", dst="{}") /
+ UDP(sport={}, dport={}) /
+ ("A"*30)
+ )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
+ main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+ endTimeMs = (time.time() + 5) * 1000
+
+ main.step("Checking drop report from DeepInsight")
+ def getDropAnomalies(*args, **kwargs):
+ return main.DeepInsight.getAnomalyRecords(
+ startTime=startTimeMs,
+ endTime=endTimeMs,
+ srcIp=srcIp,
+ dstIp=dstIp,
+ srcPort=srcPort,
+ dstPort=dstPort,
+ ipProto=socket.IPPROTO_UDP,
+ anomalyType="packet_drop",
+ )
+
+ # Need to wait few seconds until DeepInsight database updated.
+ dropAnomalies = utilities.retry(
+ f=getDropAnomalies,
+ retValue=[[]],
+ attempts=60,
+ )
+
+ utilities.assert_equals(
+ expect=1, actual=len(dropAnomalies),
+ onpass="Got 1 drop anomaly from DeepInsight as expected.",
+ onfail="Got %d drop anomaly from DeepInsight, expect 1" % (len(dropAnomalies))
+ )
+
+ main.step("Checking drop reason from the report")
+ dropAnomaly = dropAnomalies[0]
+ dropReason = dropAnomaly["DropReason"]
+
+ # DROP_REASON_PORT_VLAN_MAPPING_MISS = 55
+ utilities.assert_equals(
+ expect=55, actual=dropReason,
+ onpass="Got drop reason '55' as expected.",
+ onfail="Got drop reason '%d', expect '55'." % (dropReason)
+ )
+
+ main.step("Clean up the test")
+ intTest.cleanUp(main)
+
+ def CASE3 (self, main):
+ """
+ Send a packet with IP TTL value 1 from one host to another host and check
+ if DeepInsight receives drop reports.
+ """
+ import time
+ import socket
+ from core import utilities
+ from tests.USECASE.SegmentRouting.INT.dependencies.IntTest import IntTest
+ main.cfgName = "CASE3"
+
+ main.step("Setting up the test")
+ intTest = IntTest(scapy=True)
+ intTest.setUpTest(main)
+
+ main.step("Setting up hosts and variables")
+ srcIfaceName = main.h1.interfaces[0]["name"]
+ dstIfaceName = main.h3.interfaces[0]["name"]
+ srcMac = main.h1.getMac(srcIfaceName)
+ dstMac = main.params.get("routerMac", "00:00:00:00:00:00")
+ srcIp = main.h1.getIp(srcIfaceName)
+ dstIp = main.h3.getIp(dstIfaceName)
+ srcPort = 3000
+ dstPort = 8888
+
+ main.step("Sending a packet with IP TTL value 1 from h1")
+ startTimeMs = (time.time() - 5) * 1000
+ pkt = """(
+ Ether(src="{}", dst="{}") /
+ IP(src="{}", dst="{}", ttl=1) /
+ UDP(sport={}, dport={}) /
+ ("A"*30)
+ )""".format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
+ main.h1.sendPacket(iface=srcIfaceName, packet=pkt)
+ endTimeMs = (time.time() + 5) * 1000
+
+ main.step("Checking drop report from DeepInsight")
+ def getDropAnomalies(*args, **kwargs):
+ return main.DeepInsight.getAnomalyRecords(
+ startTime=startTimeMs,
+ endTime=endTimeMs,
+ srcIp=srcIp,
+ dstIp=dstIp,
+ srcPort=srcPort,
+ dstPort=dstPort,
+ ipProto=socket.IPPROTO_UDP,
+ anomalyType="packet_drop",
+ )
+
+ # Need to wait few seconds until DeepInsight database updated.
+ dropAnomalies = utilities.retry(
+ f=getDropAnomalies,
+ retValue=[[]],
+ attempts=60,
+ )
+
+ utilities.assert_equals(
+ expect=1, actual=len(dropAnomalies),
+ onpass="Got 1 drop anomaly from DeepInsight as expected.",
+ onfail="Got %d drop anomaly from DeepInsight, expect '1'." % (len(dropAnomalies))
+ )
+
+ main.step("Checking drop reason from report")
+ dropAnomaly = dropAnomalies[0]
+ dropReason = dropAnomaly["DropReason"]
+ # DROP_REASON_IP_TTL_ZERO = 26
+ utilities.assert_equals(
+ expect=26, actual=dropReason,
+ onpass="Got drop reason '26' as expected.",
+ onfail="Got drop reason '%d', expect '26'." % (dropReason)
+ )
+
+ main.step("Clean up the test")
+ intTest.cleanUp(main)
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/INT.topo b/TestON/tests/USECASE/SegmentRouting/INT/INT.topo
new file mode 100644
index 0000000..559d041
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/INT.topo
@@ -0,0 +1,115 @@
+<!-- SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation. -->
+<!-- SPDX-License-Identifier: GPL-2.0-or-later -->
+<TOPOLOGY>
+ <COMPONENT>
+ <Compute1>
+ <host>10.76.28.74</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>6</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>True</dhcp>
+ <ip>10.32.11.2</ip>
+ <shortName>h1</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>pairbond</ifaceName>
+ <routes>
+ <route1>
+ <network></network>
+ <netmask></netmask>
+ <gw></gw>
+ <interface></interface>
+ </route1>
+ </routes>
+ <sudo_required>false</sudo_required>
+ </COMPONENTS>
+ </Compute1>
+
+ <Compute2>
+ <host>10.76.28.72</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>7</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>True</dhcp>
+ <ip>10.32.11.3</ip>
+ <shortName>h2</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>pairbond</ifaceName>
+ <routes>
+ <route1>
+ <network></network>
+ <netmask></netmask>
+ <gw></gw>
+ <interface></interface>
+ </route1>
+ </routes>
+ <sudo_required>false</sudo_required>
+ </COMPONENTS>
+ </Compute2>
+
+ <Compute3>
+ <host>10.76.28.68</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>HostDriver</type>
+ <connect_order>8</connect_order>
+ <jump_host></jump_host>
+ <COMPONENTS>
+ <mac></mac>
+ <inband>false</inband>
+ <dhcp>True</dhcp>
+ <ip>10.32.11.194</ip>
+ <shortName>h3</shortName>
+ <port1></port1>
+ <link1></link1>
+ <ifaceName>eno2</ifaceName>
+ <routes>
+ <route1>
+ <network></network>
+ <netmask></netmask>
+ <gw></gw>
+ <interface></interface>
+ </route1>
+ </routes>
+ <sudo_required>false</sudo_required>
+ </COMPONENTS>
+ </Compute3>
+
+ <DeepInsight>
+ <host>10.76.28.74</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>DeepInsightApiDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <server_url>https://10.76.28.74:30000</server_url>
+ <username>diadmin</username>
+ <password>diadmin</password>
+ <verify_ssl>False</verify_ssl>
+ </COMPONENTS>
+ </DeepInsight>
+
+ <!-- A NetworkDriver to provide functions such as "createHostComponent" -->
+ <INTNetwork>
+ <host>localhost</host>
+ <user>jenkins</user>
+ <password></password>
+ <type>NetworkDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </INTNetwork>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/__init__.py b/TestON/tests/USECASE/SegmentRouting/INT/__init__.py
new file mode 100644
index 0000000..3a5d80e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/__init__.py
@@ -0,0 +1,2 @@
+# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
+# SPDX-License-Identifier: GPL-2.0-or-later
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/dependencies/IntTest.py b/TestON/tests/USECASE/SegmentRouting/INT/dependencies/IntTest.py
new file mode 100644
index 0000000..2c6a99e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/dependencies/IntTest.py
@@ -0,0 +1,29 @@
+# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from tests.dependencies.Network import Network
+
+class IntTest:
+
+ def __init__(self, scapy=False):
+ self.hosts = ["h1", "h2", "h3"]
+ self.scapy = scapy
+
+ def setUpTest(self, main):
+ main.Network = Network()
+ main.Network.connectToNet()
+
+ for host in self.hosts:
+ main.Network.createHostComponent(host)
+ if self.scapy:
+ hostHandle = getattr(main, host)
+ hostHandle.sudoRequired = True
+ hostHandle.startScapy()
+
+ def cleanUp(self, main):
+ for host in self.hosts:
+ if self.scapy:
+ hostHandle = getattr(main, host)
+ hostHandle.stopScapy()
+ main.Network.removeHostComponent(host)
+ main.Network.disconnectFromNet()
diff --git a/TestON/tests/USECASE/SegmentRouting/INT/dependencies/__init__.py b/TestON/tests/USECASE/SegmentRouting/INT/dependencies/__init__.py
new file mode 100644
index 0000000..3a5d80e
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/INT/dependencies/__init__.py
@@ -0,0 +1,2 @@
+# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
+# SPDX-License-Identifier: GPL-2.0-or-later
diff --git a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.params b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.params
index 7d19924..27e2cc4 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.params
+++ b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.params
@@ -1,5 +1,5 @@
<PARAMS>
- <testcases>1,2,101,102,103,104,301,302,303,304</testcases>
+ <testcases>1,2,101,102,103,104,301</testcases>
<GRAPH>
<nodeCluster>pairedleaves</nodeCluster>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.py b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.py
index a292173..fe7c839 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.py
@@ -681,252 +681,3 @@
# Cleanup
main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
main.funcs.cleanup( main )
-
- def CASE302 ( self, main ):
- """
- Send ping packets from one host to another host and check flows from DeepInsight.
- """
-
- try:
- from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- from core import utilities
- import time
- import socket
- except ImportError as e:
- main.log.exception( "SRStagingTest not found. Exiting the test" )
- main.cleanAndExit()
- try:
- main.funcs
- except ( NameError, AttributeError ):
- main.funcs = SRStagingTest()
-
- pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
- main.cfgName = 'CASE302'
- main.funcs.setupTest( main,
- topology='0x2',
- onosNodes=3,
- description="INT flow report tests on %s POD" % ( pod ) )
- startTimeMs = ( time.time() - 5 ) * 1000
- run.verifyPing( main, ['h1'], ['h2'] )
- endTimeMs = ( time.time() + 5 ) * 1000
- main.step( "Checking flow report from DeepInsight" )
-
- def getFiveTupleCount(*args, **kwargs):
- flows = main.DeepInsight.getFlows(
- startTimeMs=startTimeMs,
- endTimeMs=endTimeMs,
- srcIp=main.h1.interfaces[0]['ips'][0],
- dstIp=main.h2.interfaces[0]['ips'][0],
- ipProto=socket.IPPROTO_ICMP
- )
- if "FiveTupleCount" in flows:
- return flows["FiveTupleCount"]
- else:
- return 0
-
- # Need to wait few seconds until DeepInsight database updated.
- fiveTupleCount = utilities.retry(
- f=getFiveTupleCount,
- retValue=0,
- attempts=60,
- )
-
- utilities.assert_equals(
- expect=1, actual=fiveTupleCount,
- onpass="Got 1 flow report from DeepInsight as expected.",
- onfail="Got %d flow reports from DeepInsight (expect 1)" % ( fiveTupleCount )
- )
-
- main.funcs.cleanup( main )
-
- def CASE303 ( self, main ):
- """
- Send a packet with invalid VLAN from one host to another host and check
- if DeepInsight receives drop reports.
- """
-
- try:
- from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- from core import utilities
- import time
- import socket
- except ImportError as e:
- main.log.exception( "SRStagingTest not found. Exiting the test" )
- main.cleanAndExit()
- try:
- main.funcs
- except ( NameError, AttributeError ):
- main.funcs = SRStagingTest()
-
- pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
- main.cfgName = 'CASE303'
- main.funcs.setupTest( main,
- topology='0x2',
- onosNodes=3,
- description="INT drop report tests on %s POD with invalid VLAN" % ( pod ) )
- # FIXME: Remove this ping test
- # Use this ping function to initialize 'main.h1' and 'main.h2'.
- # Same question, maybe there is a better way to initialize them?
- run.verifyPing( main, ['h1', 'h2'], ['h2'] )
- main.h1.sudoRequired = True
- main.h2.sudoRequired = True
- main.h1.startScapy()
- main.h2.startScapy()
- srcIfaceName = main.h1.interfaces[0]['name']
- dstIfaceName = main.h2.interfaces[0]['name']
- srcMac = main.h1.getMac(srcIfaceName)
- dstMac = main.h2.getMac(dstIfaceName)
- srcIp = main.h1.getIp(srcIfaceName)
- dstIp = main.h2.getIp(dstIfaceName)
- srcPort = 2000
- dstPort = 8888
-
- main.step( "Sending a packet with invalid VLAN ID from h1" )
- startTimeMs = ( time.time() - 5 ) * 1000
- pkt = '''(
- Ether(src='{}', dst='{}') /
- Dot1Q(vlan=123) /
- IP(src='{}', dst='{}') /
- UDP(sport={}, dport={}) /
- ('A'*30)
- )'''.format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
- main.h1.sendPacket( iface=srcIfaceName, packet=pkt )
- endTimeMs = ( time.time() + 5 ) * 1000
-
- main.step( "Checking drop report from DeepInsight" )
- def getDropAnomalies(*args, **kwargs):
- return main.DeepInsight.getAnomalyRecords(
- startTime=startTimeMs,
- endTime=endTimeMs,
- srcIp=srcIp,
- dstIp=dstIp,
- srcPort=srcPort,
- dstPort=dstPort,
- ipProto=socket.IPPROTO_UDP,
- anomalyType="packet_drop",
- )
-
- # Need to wait few seconds until DeepInsight database updated.
- dropAnomalies = utilities.retry(
- f=getDropAnomalies,
- retValue=[[]],
- attempts=60,
- )
-
- utilities.assert_equals(
- expect=1, actual=len(dropAnomalies),
- onpass="Got 1 drop anomaly from DeepInsight as expected.",
- onfail="Got %d drop anomaly from DeepInsight (expect 1)" % ( len(dropAnomalies) )
- )
-
- dropAnomaly = dropAnomalies[0]
- dropReason = dropAnomaly["DropReason"]
-
- # DROP_REASON_PORT_VLAN_MAPPING_MISS = 55
- utilities.assert_equals(
- expect=55, actual=dropReason,
- onpass="Got drop reason '55' as expected.",
- onfail="Got drop reason '%d', expect '55'." % ( dropReason )
- )
-
- main.h1.stopScapy()
- main.h2.stopScapy()
- main.funcs.cleanup( main )
-
- def CASE304 ( self, main ):
- """
- Send a packet with IP TTL value 1 from one host to another host and check
- if DeepInsight receives drop reports.
- """
-
- try:
- from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
- from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
- from core import utilities
- import time
- import socket
- import json
- except ImportError as e:
- main.log.exception( "SRStagingTest not found. Exiting the test" )
- main.cleanAndExit()
- try:
- main.funcs
- except ( NameError, AttributeError ):
- main.funcs = SRStagingTest()
-
- pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
- main.cfgName = 'CASE304'
- main.funcs.setupTest( main,
- topology='0x2',
- onosNodes=3,
- description="INT drop report tests with IP TTL 1 on %s POD" % ( pod ) )
- # FIXME: Remove this ping test
- # Use this ping function to initialize 'main.h1' and 'main.h3'.
- # Is there a better way to initialize them?
- run.verifyPing( main, ['h1'], ['h3'] )
- main.h1.sudoRequired = True
- main.h3.sudoRequired = True
- main.h1.startScapy()
- main.h3.startScapy()
- srcIfaceName = main.h1.interfaces[0]['name']
- dstIfaceName = main.h3.interfaces[0]['name']
- srcMac = main.h1.getMac(srcIfaceName)
- netcfgJson = json.loads( main.Cluster.active( 0 ).getNetCfg( subjectClass='devices') )
- dstMac = netcfgJson["device:leaf2"]["segmentrouting"]["routerMac"]
- srcIp = main.h1.getIp(srcIfaceName)
- dstIp = main.h3.getIp(dstIfaceName)
- srcPort = 3000
- dstPort = 8888
-
- main.step( "Sending a packet with IP TTL value 1 from h1" )
- startTimeMs = ( time.time() - 5 ) * 1000
- pkt = '''(
- Ether(src='{}', dst='{}') /
- IP(src='{}', dst='{}', ttl=1) /
- UDP(sport={}, dport={}) /
- ('A'*30)
- )'''.format(srcMac, dstMac, srcIp, dstIp, srcPort, dstPort)
- main.h1.sendPacket( iface=srcIfaceName, packet=pkt )
- endTimeMs = ( time.time() + 5 ) * 1000
-
- main.step( "Checking drop report from DeepInsight" )
- def getDropAnomalies(*args, **kwargs):
- return main.DeepInsight.getAnomalyRecords(
- startTime=startTimeMs,
- endTime=endTimeMs,
- srcIp=srcIp,
- dstIp=dstIp,
- srcPort=srcPort,
- dstPort=dstPort,
- ipProto=socket.IPPROTO_UDP,
- anomalyType="packet_drop",
- )
-
- # Need to wait few seconds until DeepInsight database updated.
- dropAnomalies = utilities.retry(
- f=getDropAnomalies,
- retValue=[[]],
- attempts=60,
- )
-
- utilities.assert_equals(
- expect=1, actual=len(dropAnomalies),
- onpass="Got 1 drop anomaly from DeepInsight as expected.",
- onfail="Got %d drop anomaly from DeepInsight (expect 1)" % ( len(dropAnomalies) )
- )
-
- dropAnomaly = dropAnomalies[0]
- dropReason = dropAnomaly["DropReason"]
-
- # DROP_REASON_IP_TTL_ZERO = 26
- utilities.assert_equals(
- expect=26, actual=dropReason,
- onpass="Got drop reason '26' as expected.",
- onfail="Got drop reason '%d', expect 26" % ( dropReason )
- )
-
- main.h1.stopScapy()
- main.h3.stopScapy()
- main.funcs.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.topo b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.topo
index e529c6f..40bf030 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.topo
+++ b/TestON/tests/USECASE/SegmentRouting/SRStaging/SRpairedLeaves/SRpairedLeaves.topo
@@ -184,19 +184,5 @@
</COMPONENTS>
</NetworkBench>
- <DeepInsight>
- <host>10.76.28.74</host>
- <user>jenkins</user>
- <password></password>
- <type>DeepInsightApiDriver</type>
- <connect_order>1</connect_order>
- <COMPONENTS>
- <server_url>https://10.76.28.74:30000</server_url>
- <username>diadmin</username>
- <password>diadmin</password>
- <verify_ssl>False</verify_ssl>
- </COMPONENTS>
- </DeepInsight>
-
</COMPONENT>
</TOPOLOGY>