diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDao.java b/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDao.java index 057eeec6272f..3a2aaa4a8672 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDao.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDao.java @@ -25,7 +25,8 @@ public interface ASNumberDao extends GenericDao { Pair, Integer> searchAndCountByZoneOrRangeOrAllocated(Long zoneId, Long asnRangeId, Integer asNumber, Long networkId, Long vpcId, - Boolean allocated, Long accountId, Long domainId, Long startIndex, Long pageSizeVal); + Boolean allocated, Long accountId, Long domainId, String keyword, + Long startIndex, Long pageSizeVal); ASNumberVO findByAsNumber(Long asNumber); ASNumberVO findOneByAllocationStateAndZone(long zoneId, boolean allocated); diff --git a/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDaoImpl.java b/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDaoImpl.java index bf778fc94010..8cc256e2acb1 100644 --- a/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/dc/dao/ASNumberDaoImpl.java @@ -47,6 +47,7 @@ public Pair, Integer> searchAndCountByZoneOrRangeOrAllocated(Lo Integer asNumber, Long networkId, Long vpcId, Boolean allocated, Long accountId, Long domainId, + String keyword, Long startIndex, Long pageSizeVal) { SearchCriteria sc = asNumberSearch.create(); if (zoneId != null) { @@ -73,6 +74,9 @@ public Pair, Integer> searchAndCountByZoneOrRangeOrAllocated(Lo if (domainId != null) { sc.setParameters("domainId", domainId); } + if (keyword != null) { + sc.addAnd("asNumber", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + } Filter searchFilter = new Filter(ASNumberVO.class, "id", true, startIndex, pageSizeVal); return searchAndCount(sc, searchFilter); } diff --git a/server/src/main/java/com/cloud/bgp/BGPServiceImpl.java b/server/src/main/java/com/cloud/bgp/BGPServiceImpl.java index 2ca47b77558d..b5639f75d377 100644 --- a/server/src/main/java/com/cloud/bgp/BGPServiceImpl.java +++ b/server/src/main/java/com/cloud/bgp/BGPServiceImpl.java @@ -175,6 +175,7 @@ public Pair, Integer> listASNumbers(ListASNumbersCmd cmd) { Long domainId = cmd.getDomainId(); Long startIndex = cmd.getStartIndex(); Long pageSizeVal = cmd.getPageSizeVal(); + String keyword = cmd.getKeyword(); Account userAccount = null; Domain domain = null; @@ -209,7 +210,7 @@ public Pair, Integer> listASNumbers(ListASNumbersCmd cmd) { } Pair, Integer> pair = asNumberDao.searchAndCountByZoneOrRangeOrAllocated(zoneId, asNumberRangeId, asNumber, networkSearchId, vpcSerchId, allocated, Objects.nonNull(userAccount) ? userAccount.getId() : null, - Objects.nonNull(domain) ? domain.getId() : null, startIndex, pageSizeVal); + Objects.nonNull(domain) ? domain.getId() : null, keyword, startIndex, pageSizeVal); return new Pair<>(new ArrayList<>(pair.first()), pair.second()); } diff --git a/server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java b/server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java index 593fc449fe7f..39612a8f11ea 100644 --- a/server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/network/RoutedIpv4ManagerImpl.java @@ -518,8 +518,9 @@ public List listIpv4GuestSubnetsForGuestNetwork(ListI sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId); } if (keyword != null) { - sc.addAnd("subnet", SearchCriteria.Op.LIKE, keyword); + sc.addAnd("subnet", SearchCriteria.Op.LIKE, "%" + keyword + "%"); } + return ipv4GuestSubnetNetworkMapDao.search(sc, null); }