Skip to content

Commit cbbed24

Browse files
author
Chirag Jog
committed
Adding ELP/EIP tests & firewall rule changes for SSH
1 parent 5168995 commit cbbed24

21 files changed

Lines changed: 2673 additions & 485 deletions

‎test/integration/component/test_egress_rules.py‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Services:
3434

3535
def __init__(self):
3636
self.services = {
37-
"disk_offering": {
37+
"disk_offering":{
3838
"displaytext": "Small",
3939
"name": "Small",
4040
"disksize": 1
@@ -64,8 +64,8 @@ def __init__(self):
6464
"name": "Tiny Instance",
6565
"displaytext": "Tiny Instance",
6666
"cpunumber": 1,
67-
"cpuspeed": 100, # in MHz
68-
"memory": 64, # In MBs
67+
"cpuspeed": 100, # in MHz
68+
"memory": 64, # In MBs
6969
},
7070
"security_group": {
7171
"name": 'SSH',
@@ -107,9 +107,8 @@ def __init__(self):
107107
"protocol": 'TCP',
108108
"startport": 22,
109109
"endport": 22,
110-
"cidrlist": '0.0.0.0/0',
111110
},
112-
"mgmt_server": {
111+
"mgmt_server": {
113112
"username": "root",
114113
"password": "fr3sca",
115114
"ipaddress": "192.168.100.21"
@@ -118,7 +117,7 @@ def __init__(self):
118117
# CentOS 5.3 (64-bit)
119118
"sleep": 60,
120119
"timeout": 10,
121-
"mode": 'basic',
120+
"mode":'basic',
122121
# Networking mode: Basic or Advanced
123122
}
124123

@@ -801,7 +800,7 @@ def test_01_default_group_with_egress(self):
801800
# --- www.l.google.com ping statistics ---
802801
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms
803802
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
804-
self.debug("SSH result: %s" %str(res))
803+
self.debug("SSH result: %s" % str(res))
805804
except Exception as e:
806805
self.fail("SSH Access failed for %s: %s" % \
807806
(self.virtual_machine.ipaddress, e)
@@ -985,7 +984,7 @@ def test_revoke_egress_rule(self):
985984
# --- www.l.google.com ping statistics ---
986985
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms
987986
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
988-
self.debug("SSH result: %s" % str(res))
987+
self.debug("SSH result: %s" % str(res))
989988
except Exception as e:
990989
self.fail("SSH Access failed for %s: %s" % \
991990
(self.virtual_machine.ipaddress, e)
@@ -1026,7 +1025,7 @@ def test_revoke_egress_rule(self):
10261025

10271026
result = security_group.revokeEgress(
10281027
self.apiclient,
1029-
id=ssh_egress_rule["ruleid"]
1028+
id = ssh_egress_rule["ruleid"]
10301029
)
10311030
self.debug("Revoke egress rule result: %s" % result)
10321031

@@ -1319,14 +1318,14 @@ def test_multiple_account_egress_rule_negative(self):
13191318
"Authorizing egress rule for sec group ID: %s for ssh access"
13201319
% security_group.id)
13211320
# Authorize to only account not CIDR
1322-
user_secgrp_list = {self.accountB.account.name: 'default'}
1321+
user_secgrp_list = {self.accountB.account.name: 'default'}
13231322

13241323
egress_rule = security_group.authorizeEgress(
13251324
self.apiclient,
13261325
self.services["sg_account"],
13271326
account=self.accountA.account.name,
13281327
domainid=self.accountA.account.domainid,
1329-
user_secgrp_list=user_secgrp_list
1328+
user_secgrp_list=user_secgrp_list
13301329
)
13311330

13321331
self.assertEqual(
@@ -1422,7 +1421,7 @@ def test_multiple_account_egress_rule_negative(self):
14221421

14231422
try:
14241423
self.debug("SSHing into VM type B from VM A")
1425-
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
1424+
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
14261425
res = ssh.execute("ssh %s@%s" % (
14271426
self.services["virtual_machine"]["username"],
14281427
self.virtual_machineB.ssh_ip
@@ -1592,14 +1591,14 @@ def test_multiple_account_egress_rule_positive(self):
15921591
"Authorizing egress rule for sec group ID: %s for ssh access"
15931592
% security_groupA.id)
15941593
# Authorize to only account not CIDR
1595-
user_secgrp_list = {self.accountB.account.name: security_groupB.name}
1594+
user_secgrp_list = {self.accountB.account.name: security_groupB.name}
15961595

15971596
egress_rule = security_groupA.authorizeEgress(
15981597
self.apiclient,
15991598
self.services["sg_account"],
16001599
account=self.accountA.account.name,
16011600
domainid=self.accountA.account.domainid,
1602-
user_secgrp_list=user_secgrp_list
1601+
user_secgrp_list=user_secgrp_list
16031602
)
16041603

16051604
self.assertEqual(
@@ -1716,7 +1715,7 @@ def test_multiple_account_egress_rule_positive(self):
17161715

17171716
try:
17181717
self.debug("SSHing into VB type B from VM A")
1719-
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
1718+
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
17201719

17211720
res = ssh.execute("ssh %s@%s" % (
17221721
self.services["virtual_machine"]["username"],
@@ -1945,7 +1944,6 @@ def test_start_stop_vm_egress(self):
19451944
)
19461945
return
19471946

1948-
19491947
@unittest.skip("Valid bug- ID: CS-12647")
19501948
class TestInvalidParametersForEgress(cloudstackTestCase):
19511949

@@ -2306,12 +2304,12 @@ def test_egress_after_host_maintainance(self):
23062304
)
23072305
vm = vms[0]
23082306

2309-
self.debug("Enabling host maintainance for ID: %s" % vm.hostid)
2307+
self.debug("Enabling host maintainance for ID: %s" % host.id)
23102308
cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
23112309
cmd.id = vm.hostid
23122310
self.apiclient.prepareHostForMaintenance(cmd)
23132311

2314-
self.debug("Canceling host maintainance for ID: %s" % vm.hostid)
2312+
self.debug("Canceling host maintainance for ID: %s" % host.id)
23152313
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
23162314
cmd.id = vm.hostid
23172315
self.apiclient.cancelHostMaintenance(cmd)

0 commit comments

Comments
 (0)