Skip to content

Commit 53cb769

Browse files
committed
fix ci simulator tests
1 parent a905be8 commit 53cb769

File tree

3 files changed

+118
-42
lines changed

3 files changed

+118
-42
lines changed

plugins/metrics/src/main/java/org/apache/cloudstack/response/ManagementServerMetricsResponse.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,13 @@
2222
import org.apache.cloudstack.api.response.ManagementServerResponse;
2323

2424
import java.util.Date;
25-
import java.util.List;
2625

2726
public class ManagementServerMetricsResponse extends ManagementServerResponse {
2827

2928
@SerializedName(MetricConstants.AVAILABLE_PROCESSORS)
3029
@Param(description = "the number of processors available to the JVM")
3130
private Integer availableProcessors;
3231

33-
@SerializedName(MetricConstants.LAST_AGENTS)
34-
@Param(description = "the last agents this Management Server is responsible for, before shutdown or preparing for maintenance", since = "4.21.0.0")
35-
private List<String> lastAgents;
36-
37-
@SerializedName(MetricConstants.AGENTS)
38-
@Param(description = "the agents this Management Server is responsible for", since = "4.21.0.0")
39-
private List<String> agents;
40-
4132
@SerializedName(MetricConstants.AGENT_COUNT)
4233
@Param(description = "the number of agents this Management Server is responsible for")
4334
private Integer agentCount;
@@ -130,14 +121,6 @@ public void setAvailableProcessors(int availableProcessors) {
130121
this.availableProcessors = availableProcessors;
131122
}
132123

133-
public void setLastAgents(List<String> lastAgents) {
134-
this.lastAgents = lastAgents;
135-
}
136-
137-
public void setAgents(List<String> agents) {
138-
this.agents = agents;
139-
}
140-
141124
public void setAgentCount(int agentCount) {
142125
this.agentCount = agentCount;
143126
}

test/integration/component/test_project_usage.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,17 +1707,10 @@ def setUpClass(cls):
17071707
listall=True
17081708
)
17091709
if isinstance(networks, list):
1710-
network = networks[0]
1710+
cls.network = networks[0]
17111711
else:
17121712
raise Exception("List networks call failed")
17131713

1714-
cls.public_ip = PublicIPAddress.create(
1715-
cls.api_client,
1716-
zoneid=cls.zone.zoneid,
1717-
services=cls.services["server"],
1718-
networkid=network.id,
1719-
projectid=cls.project.id
1720-
)
17211714
cls._cleanup = [
17221715
cls.project,
17231716
cls.service_offering,
@@ -1760,12 +1753,20 @@ def test_01_vpn_usage(self):
17601753
# this account in cloud.usage_event table
17611754
# 4. Delete this account.
17621755

1763-
self.debug("Created VPN with public IP: %s" %
1764-
self.public_ip.ipaddress.id)
1765-
#Assign VPN to Public IP
1756+
# Listing source NAT IP of newly added network
1757+
ipAddresses = PublicIPAddress.list(
1758+
self.apiclient,
1759+
associatednetworkid=self.network.id,
1760+
projectid=self.project.id,
1761+
issourcenat=True)
1762+
1763+
sourceNatIP = ipAddresses[0]
1764+
self.debug("Created VPN with source NAT IP: %s" %
1765+
sourceNatIP.id)
1766+
#Assign VPN to source NAT IP
17661767
vpn = Vpn.create(
17671768
self.apiclient,
1768-
self.public_ip.ipaddress.id,
1769+
sourceNatIP.id,
17691770
projectid=self.project.id
17701771
)
17711772

test/integration/component/test_vpn_users.py

Lines changed: 105 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,18 @@ def tearDown(self):
165165
def create_VPN(self, public_ip):
166166
"""Creates VPN for the network"""
167167

168-
self.debug("Creating VPN with public IP: %s" % public_ip.ipaddress.id)
168+
self.debug("Creating VPN with public IP: %s" % public_ip.id)
169169
try:
170170
# Assign VPN to Public IP
171171
vpn = Vpn.create(self.apiclient,
172-
self.public_ip.ipaddress.id,
172+
public_ip.id,
173173
account=self.account.name,
174174
domainid=self.account.domainid)
175175
self.cleanup.append(vpn)
176176

177177
self.debug("Verifying the remote VPN access")
178178
vpns = Vpn.list(self.apiclient,
179-
publicipid=public_ip.ipaddress.id,
179+
publicipid=public_ip.id,
180180
listall=True)
181181
self.assertEqual(
182182
isinstance(vpns, list),
@@ -244,7 +244,23 @@ def test_01_VPN_user_limit(self):
244244
self.debug("Enabling the VPN access for IP: %s" %
245245
self.public_ip.ipaddress)
246246

247-
self.create_VPN(self.public_ip)
247+
network_id = self.virtual_machine.nic[0].networkid
248+
src_nat_list = PublicIPAddress.list(
249+
self.apiclient,
250+
account=self.account.name,
251+
domainid=self.account.domainid,
252+
listall=True,
253+
issourcenat=True,
254+
associatednetworkid=network_id
255+
)
256+
self.assertEqual(
257+
validateList(src_nat_list)[0],
258+
PASS,
259+
"Failed to list source nat ip address"
260+
)
261+
ip = src_nat_list[0]
262+
263+
self.create_VPN(ip)
248264
self.debug("Creating %s VPN users" % limit)
249265
for x in range(limit):
250266
self.create_VPN_Users()
@@ -296,9 +312,24 @@ def test_03_enable_vpn_use_port(self):
296312
# 3. add a port forward rule for UDP port 1701. Should result in error
297313
# saying that VPN is enabled over port 1701
298314

315+
network_id = self.virtual_machine.nic[0].networkid
316+
src_nat_list = PublicIPAddress.list(
317+
self.apiclient,
318+
account=self.account.name,
319+
domainid=self.account.domainid,
320+
listall=True,
321+
issourcenat=True,
322+
associatednetworkid=network_id
323+
)
324+
self.assertEqual(
325+
validateList(src_nat_list)[0],
326+
PASS,
327+
"Failed to list source nat ip address"
328+
)
329+
ip = src_nat_list[0]
299330
self.debug("Enabling the VPN connection for IP: %s" %
300-
self.public_ip.ipaddress)
301-
self.create_VPN(self.public_ip)
331+
ip.address)
332+
self.create_VPN(ip)
302333

303334
self.debug("Creating a port forwarding rule on port 1701")
304335
# Create NAT rule
@@ -307,7 +338,7 @@ def test_03_enable_vpn_use_port(self):
307338
self.apiclient,
308339
self.virtual_machine,
309340
self.services["natrule"],
310-
self.public_ip.ipaddress.id)
341+
ip.id)
311342

312343
self.debug("Create NAT rule failed! Test successful!")
313344
return
@@ -322,9 +353,25 @@ def test_04_add_new_users(self):
322353
# 3. We should be able to successfully establish a VPN connection using
323354
# the newly added user credential.
324355

356+
network_id = self.virtual_machine.nic[0].networkid
357+
src_nat_list = PublicIPAddress.list(
358+
self.apiclient,
359+
account=self.account.name,
360+
domainid=self.account.domainid,
361+
listall=True,
362+
issourcenat=True,
363+
associatednetworkid=network_id
364+
)
365+
self.assertEqual(
366+
validateList(src_nat_list)[0],
367+
PASS,
368+
"Failed to list source nat ip address"
369+
)
370+
ip = src_nat_list[0]
371+
325372
self.debug("Enabling the VPN connection for IP: %s" %
326-
self.public_ip.ipaddress)
327-
self.create_VPN(self.public_ip)
373+
ip.address)
374+
self.create_VPN(ip)
328375

329376
try:
330377
self.debug("Adding new VPN user to account: %s" %
@@ -349,9 +396,24 @@ def test_05_add_duplicate_user(self):
349396
# 2. Add a VPN user say "abc" that already an added user to the VPN.
350397
# 3. Adding this VPN user should fail.
351398

399+
network_id = self.virtual_machine.nic[0].networkid
400+
src_nat_list = PublicIPAddress.list(
401+
self.apiclient,
402+
account=self.account.name,
403+
domainid=self.account.domainid,
404+
listall=True,
405+
issourcenat=True,
406+
associatednetworkid=network_id
407+
)
408+
self.assertEqual(
409+
validateList(src_nat_list)[0],
410+
PASS,
411+
"Failed to list source nat ip address"
412+
)
413+
ip = src_nat_list[0]
352414
self.debug("Enabling the VPN connection for IP: %s" %
353-
self.public_ip.ipaddress)
354-
self.create_VPN(self.public_ip)
415+
ip.address)
416+
self.create_VPN(ip)
355417

356418
self.debug("Adding new VPN user to account: %s" %
357419
self.account.name)
@@ -379,9 +441,24 @@ def test_06_add_VPN_user_global_admin(self):
379441
# 2. We should be able to use this newly created user credential to
380442
# establish VPN connection that will give access all VMs of this user
381443

444+
network_id = self.virtual_machine.nic[0].networkid
445+
src_nat_list = PublicIPAddress.list(
446+
self.apiclient,
447+
account=self.account.name,
448+
domainid=self.account.domainid,
449+
listall=True,
450+
issourcenat=True,
451+
associatednetworkid=network_id
452+
)
453+
self.assertEqual(
454+
validateList(src_nat_list)[0],
455+
PASS,
456+
"Failed to list source nat ip address"
457+
)
458+
ip = src_nat_list[0]
382459
self.debug("Enabling VPN connection to account: %s" %
383460
self.account.name)
384-
self.create_VPN(self.public_ip)
461+
self.create_VPN(ip)
385462
self.debug("Creating VPN user for the account: %s" %
386463
self.account.name)
387464
self.create_VPN_Users()
@@ -422,9 +499,24 @@ def test_07_add_VPN_user_domain_admin(self):
422499
# 2. We should be able to use this newly created user credential to
423500
# establish VPN connection that will give access all VMs of this user
424501

502+
network_id = self.virtual_machine.nic[0].networkid
503+
src_nat_list = PublicIPAddress.list(
504+
self.apiclient,
505+
account=self.account.name,
506+
domainid=self.account.domainid,
507+
listall=True,
508+
issourcenat=True,
509+
associatednetworkid=network_id
510+
)
511+
self.assertEqual(
512+
validateList(src_nat_list)[0],
513+
PASS,
514+
"Failed to list source nat ip address"
515+
)
516+
ip = src_nat_list[0]
425517
self.debug("Enabling VPN connection to account: %s" %
426518
self.account.name)
427-
self.create_VPN(self.public_ip)
519+
self.create_VPN(ip)
428520
self.debug("Creating VPN user for the account: %s" %
429521
self.account.name)
430522
self.create_VPN_Users()

0 commit comments

Comments
 (0)