Skip to content

Commit 8af9c0a

Browse files
author
shatoboar
committed
Cleaned up comments and imports
1 parent ff478a4 commit 8af9c0a

File tree

1 file changed

+2
-96
lines changed

1 file changed

+2
-96
lines changed

test/integration/component/test_persistent_networks.py

Lines changed: 2 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@
3434
NATRule,
3535
FireWallRule,
3636
Host,
37-
StaticNATRule, Cluster)
37+
StaticNATRule)
3838
from marvin.lib.common import (get_domain,
3939
get_zone,
4040
get_template,
4141
verifyNetworkState,
4242
add_netscaler,
43-
wait_for_cleanup, list_routers, list_hosts, list_clusters)
44-
from marvin.lib.vcenter import Vcenter
43+
wait_for_cleanup, list_routers, list_hosts)
4544
from nose.plugins.attrib import attr
4645
from marvin.codes import PASS, FAIL, FAILED
4746
from marvin.sshClient import SshClient
@@ -50,98 +49,6 @@
5049
from ddt import ddt, data
5150
import time
5251

53-
import logging
54-
55-
logger = logging.getLogger('TestPesistentNetwork')
56-
stream_handler = logging.StreamHandler()
57-
logger.setLevel(logging.DEBUG)
58-
logger.addHandler(stream_handler)
59-
60-
"""
61-
class TestHelper():
62-
def __init__(self, api_client):
63-
self.api_client = api_client
64-
65-
@staticmethod
66-
def get_ssh_client(ip, username, password, retries=10):
67-
try:
68-
ssh_client = SshClient(ip, 22, username, password, retries)
69-
except Exception as e:
70-
raise unittest.SkipTest("Unable to create ssh connection: " % e)
71-
72-
# self.assertIsNotNone(
73-
# ssh_client, "Failed to setup ssh connection to ip=%s" % ip)
74-
return ssh_client
75-
76-
@staticmethod
77-
def verify_vlan_network_creation(vlan_id, ssh_client):
78-
try:
79-
res = ssh_client.execute(
80-
"xe vlan-list | grep -x \"^\s*tag ( RO): \"" + str(vlan_id) + "> /dev/null 2>&1; echo $?")
81-
return res[0]
82-
except Exception as e:
83-
return False
84-
85-
@staticmethod
86-
def verify_bridge_creation(vlan_id, ssh_client):
87-
try:
88-
res = ssh_client.execute("ip addr | grep breth0-" + str(vlan_id) + " > /dev/null 2>&1; echo $?")
89-
return res[0]
90-
except Exception as e:
91-
return False
92-
93-
def validate_persistent_network_resources_created_on_host(self, network_vlan, zone_id, hypervisor):
94-
hosts = self.list_all_hosts_in_zone(zone_id)
95-
96-
if hypervisor in "kvm":
97-
for host in hosts:
98-
result = self.verify_bridge_creation(host, network_vlan)
99-
self.assertEqual(
100-
int(result),
101-
0,
102-
"Failed to find bridge on the breth0-" + str(network_vlan))
103-
elif self.hypervisor.lower() in ["xenserver", "vmware"]:
104-
self.verify_network_setup_on_host_per_cluster(self.hypervisor.lower(), network_vlan)
105-
106-
def verify_network_setup_on_host_per_cluster(hypervisor, vlan_id):
107-
clusters = Cluster.list(
108-
self.apiclient,
109-
zoneid=self.zone.id,
110-
allocationstate="Enabled",
111-
listall=True
112-
)
113-
for cluster in clusters:
114-
hosts = Host.list(self.apiclient,
115-
clusterid=cluster.id,
116-
type="Routing",
117-
state="Up",
118-
resourcestate="Enabled")
119-
host = hosts[0]
120-
if hypervisor == "xenserver":
121-
result = self.verify_vlan_network_creation(host, vlan_id)
122-
self.assertEqual(
123-
int(result),
124-
0,
125-
"Failed to find vlan on host: " + host.name + " in cluster: " + cluster.name)
126-
# if hypervisor == "vmware":
127-
# result = self.verify_port_group_creation(vlan_id)
128-
# self.assertEqual(
129-
# result,
130-
# True,
131-
# "Failed to find port group on hosts of cluster: " + cluster.name)
132-
133-
def list_all_hosts_in_zone(self, zone_id):
134-
hosts = Host.list(
135-
self.api_client,
136-
type='Routing',
137-
resourcestate='Enabled',
138-
state='Up',
139-
zoneid=zone_id
140-
)
141-
return hosts
142-
"""
143-
144-
14552
@ddt
14653
class TestPersistentNetworks(cloudstackTestCase):
14754
'''
@@ -378,7 +285,6 @@ def test_newly_added_host_for_persistent_network_resources(self):
378285
# 1. Persistent network state should be implemented before adding the host
379286
# 2. Host should be added back in successfully
380287
# 3. Host should have the persistent networks resources after being added
381-
logger.info("pls goddammit")
382288
l2_persistent_network_offering = self.createNetworkOffering("nw_off_L2_persistent")
383289
hosts = list_hosts(self.apiclient, clusterid=self.cluster.id)
384290
host = hosts[0]

0 commit comments

Comments
 (0)