Yi Tseng | 0cb9b56 | 2021-09-22 17:13:58 -0700 | [diff] [blame^] | 1 | # SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation. |
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | from tests.dependencies.Network import Network |
| 5 | |
| 6 | class IntTest: |
| 7 | |
| 8 | def __init__(self, scapy=False): |
| 9 | self.hosts = ["h1", "h2", "h3"] |
| 10 | self.scapy = scapy |
| 11 | |
| 12 | def setUpTest(self, main): |
| 13 | main.Network = Network() |
| 14 | main.Network.connectToNet() |
| 15 | |
| 16 | for host in self.hosts: |
| 17 | main.Network.createHostComponent(host) |
| 18 | if self.scapy: |
| 19 | hostHandle = getattr(main, host) |
| 20 | hostHandle.sudoRequired = True |
| 21 | hostHandle.startScapy() |
| 22 | |
| 23 | def cleanUp(self, main): |
| 24 | for host in self.hosts: |
| 25 | if self.scapy: |
| 26 | hostHandle = getattr(main, host) |
| 27 | hostHandle.stopScapy() |
| 28 | main.Network.removeHostComponent(host) |
| 29 | main.Network.disconnectFromNet() |