}
private List<ProtocolEntry> createMdsalProtocols() {
- List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
+ List<ProtocolEntry> protocolList = new ArrayList<>();
ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
protocolList.add(new ProtocolEntryBuilder().
}
public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
- Set<String> protocols = new HashSet<String>();
+ Set<String> protocols = new HashSet<>();
if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
public class ConfigActivator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class);
- private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
+ private List<ServiceRegistration<?>> registrations = new ArrayList<>();
private ProviderContext providerContext;
public ConfigActivator(ProviderContext providerContext) {
public Arp() {
payload = null;
- hdrFieldsMap = new HashMap<String, byte[]>(ARP_FIELDS_COUNT);
+ hdrFieldsMap = new HashMap<>(ARP_FIELDS_COUNT);
setHardwareLength((short) 6); // MAC address length
setProtocolLength((short) 4); // IPv4 address length
setHardwareType(ETHERNET_HW_TYPE);
private Neutron_IPs neutron_ip_src;
private Neutron_IPs neutron_ip_dest_1;
private Neutron_IPs neutron_ip_dest_2;
- private List<Neutron_IPs> neutronSrcIpList = new ArrayList<Neutron_IPs>();
- private List<Neutron_IPs> neutronDestIpList = new ArrayList<Neutron_IPs>();
+ private List<Neutron_IPs> neutronSrcIpList = new ArrayList<>();
+ private List<Neutron_IPs> neutronDestIpList = new ArrayList<>();
private static final String HOST_ADDRESS = "127.0.0.1/32";
private static final String MAC_ADDRESS = "87:1D:5E:02:40:B7";
private static final String SRC_IP = "192.168.0.1";
when(portSecurityRule.getSecurityRuleEthertype()).thenReturn("IPv4");
when(portSecurityRule.getSecurityRuleDirection()).thenReturn("egress");
- List<NeutronSecurityRule> portSecurityList = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> portSecurityList = new ArrayList<>();
portSecurityList.add(portSecurityRule);
neutron_ip_src = new Neutron_IPs();
@Mock private SecurityServicesManager securityServices;
@Mock private SecurityGroupCacheManger securityGroupCacheManger;
- private List<Neutron_IPs> neutronSrcIpList = new ArrayList<Neutron_IPs>();
- private List<Neutron_IPs> neutronDestIpList = new ArrayList<Neutron_IPs>();
+ private List<Neutron_IPs> neutronSrcIpList = new ArrayList<>();
+ private List<Neutron_IPs> neutronDestIpList = new ArrayList<>();
private Neutron_IPs neutron_ip_src;
private Neutron_IPs neutron_ip_dest_1;
private Neutron_IPs neutron_ip_dest_2;
when(portSecurityRule.getSecurityRuleEthertype()).thenReturn("IPv4");
when(portSecurityRule.getSecurityRuleDirection()).thenReturn("ingress");
- List<NeutronSecurityRule> portSecurityList = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> portSecurityList = new ArrayList<>();
portSecurityList.add(portSecurityRule);
neutron_ip_src = new Neutron_IPs();
public class ConfigActivator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class);
- private List<ServiceRegistration<?>> translatorCRUDRegistrations = new ArrayList<ServiceRegistration<?>>();
+ private List<ServiceRegistration<?>> translatorCRUDRegistrations = new ArrayList<>();
private List<Pair<Object, ServiceRegistration>> servicesAndRegistrations = new ArrayList<>();
private ProviderContext providerContext;
List<NeutronNetwork> allNetworks = neutronNetworkCache.getAllNetworks();
for (NeutronNetwork network: allNetworks) {
if (network.getID().equals(networkID)) {
- Map.Entry<String,String> entry = new AbstractMap.SimpleEntry<String, String>(
+ Map.Entry<String,String> entry = new AbstractMap.SimpleEntry<>(
network.getProviderNetworkType(), network.getProviderSegmentationID());
return entry;
}
@Override
public List<NeutronSecurityGroup> getSecurityGroupInPortList(OvsdbTerminationPointAugmentation
terminationPointAugmentation) {
- List<NeutronSecurityGroup> neutronSecurityGroups = new ArrayList<NeutronSecurityGroup>();
+ List<NeutronSecurityGroup> neutronSecurityGroups = new ArrayList<>();
if (neutronPortCache == null) {
LOG.error("neutron port is null");
return neutronSecurityGroups;
@Override
public List<Neutron_IPs> getVmListForSecurityGroup(String portUuid, String securityGroupUuid) {
- List<Neutron_IPs> vmListForSecurityGroup = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> vmListForSecurityGroup = new ArrayList<>();
/*For every port check whether security grouplist contains the current
* security group.*/
try {
}
private List<ProtocolEntry> createMdsalProtocols() {
- List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
+ List<ProtocolEntry> protocolList = new ArrayList<>();
ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
MdsalHelper.OVSDB_PROTOCOL_MAP.inverse();
protocolList.add(new ProtocolEntryBuilder().
}
public List<Node> getAllBridgesOnOvsdbNode(Node node) {
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
List<ManagedNodeEntry> managedNodes = node.getAugmentation(OvsdbNodeAugmentation.class).getManagedNodeEntry();
for (ManagedNodeEntry managedNode : managedNodes) {
InstanceIdentifier<?> bridgeIid = managedNode.getBridgeRef().getValue();
}
public List<TerminationPoint> extractTerminationPoints(Node node) {
- List<TerminationPoint> terminationPoints = new ArrayList<TerminationPoint>();
+ List<TerminationPoint> terminationPoints = new ArrayList<>();
OvsdbBridgeAugmentation ovsdbBridgeAugmentation = node.getAugmentation(OvsdbBridgeAugmentation.class);
if (ovsdbBridgeAugmentation != null) {
terminationPoints.addAll(node.getTerminationPoint());
}
public List<OvsdbTerminationPointAugmentation> extractTerminationPointAugmentations( Node node ) {
- List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<OvsdbTerminationPointAugmentation>();
+ List<OvsdbTerminationPointAugmentation> tpAugmentations = new ArrayList<>();
List<TerminationPoint> terminationPoints = node.getTerminationPoint();
if(terminationPoints != null && !terminationPoints.isEmpty()){
for(TerminationPoint tp : terminationPoints){
if(operNode != null){
return extractTerminationPointAugmentations(operNode);
}
- return new ArrayList<OvsdbTerminationPointAugmentation>();
+ return new ArrayList<>();
}
public String getInterfaceExternalIdsValue(
tpAugmentationBuilder.setInterfaceType(MdsalHelper.OVSDB_INTERFACE_TYPE_MAP.get(type));
}
- List<Options> optionsList = new ArrayList<Options>();
+ List<Options> optionsList = new ArrayList<>();
for (Map.Entry<String, String> entry : options.entrySet()) {
OptionsBuilder optionsBuilder = new OptionsBuilder();
optionsBuilder.setKey(new OptionsKey(entry.getKey()));
}
public Boolean addPatchTerminationPoint(Node node, String bridgeName, String portName, String peerPortName) {
- Map<String, String> option = new HashMap<String, String>();
+ Map<String, String> option = new HashMap<>();
option.put("peer", peerPortName);
return addTerminationPoint(node, bridgeName, portName, PATCH_PORT_TYPE, option);
}
ans.setFirewallPolicyIsShared(firewallPolicyIsShared);
}
if (s.equals("firewall_rules")) {
- List<String> firewallRuleList = new ArrayList<String>();
+ List<String> firewallRuleList = new ArrayList<>();
firewallRuleList.addAll(this.getFirewallPolicyRules());
ans.setFirewallPolicyRules(firewallRuleList);
}
}
public void initDefaults() {
- subnets = new ArrayList<String>();
+ subnets = new ArrayList<>();
if (status == null) {
status = "ACTIVE";
}
ans.setStatus(this.getStatus());
}
if (s.equals("subnets")) {
- List<String> subnetList = new ArrayList<String>();
+ List<String> subnetList = new ArrayList<>();
subnetList.addAll(this.getSubnets());
ans.setSubnets(subnetList);
}
ans.setMacAddress(this.getMacAddress());
}
if ("fixed_ips".equals(field)) {
- ans.setFixedIPs(new ArrayList<Neutron_IPs>(this.getFixedIPs()));
+ ans.setFixedIPs(new ArrayList<>(this.getFixedIPs()));
}
if ("device_id".equals(field)) {
ans.setDeviceID(this.getDeviceID());
ans.setTenantID(this.getTenantID());
}
if ("security_groups".equals(field)) {
- ans.setSecurityGroups(new ArrayList<NeutronSecurityGroup>(this.getSecurityGroups()));
+ ans.setSecurityGroups(new ArrayList<>(this.getSecurityGroups()));
}
}
return ans;
status = "ACTIVE";
}
if (fixedIPs == null) {
- fixedIPs = new ArrayList<Neutron_IPs>();
+ fixedIPs = new ArrayList<>();
}
}
Map<String, NeutronRouter_Interface> interfaces;
public NeutronRouter() {
- interfaces = new HashMap<String, NeutronRouter_Interface>();
+ interfaces = new HashMap<>();
}
public String getID() { return routerUUID; }
List<NeutronSecurityRule> neutronSecurityRule;
public NeutronSecurityGroup() {
- neutronSecurityRule = new ArrayList<NeutronSecurityRule>();
+ neutronSecurityRule = new ArrayList<>();
}
List<NeutronPort> myPorts;
public NeutronSubnet() {
- myPorts = new ArrayList<NeutronPort>();
+ myPorts = new ArrayList<>();
}
// @deprecated - will be removed in Boron
ans.setGatewayIP(this.getGatewayIP());
}
if (s.equals("dns_nameservers")) {
- List<String> nsList = new ArrayList<String>();
+ List<String> nsList = new ArrayList<>();
nsList.addAll(this.getDnsNameservers());
ans.setDnsNameservers(nsList);
}
if (s.equals("allocation_pools")) {
- List<NeutronSubnetIPAllocationPool> aPools = new ArrayList<NeutronSubnetIPAllocationPool>();
+ List<NeutronSubnetIPAllocationPool> aPools = new ArrayList<>();
aPools.addAll(this.getAllocationPools());
ans.setAllocationPools(aPools);
}
if (s.equals("host_routes")) {
- List<NeutronSubnet_HostRoute> hRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+ List<NeutronSubnet_HostRoute> hRoutes = new ArrayList<>();
hRoutes.addAll(this.getHostRoutes());
ans.setHostRoutes(hRoutes);
}
// @deprecated - will be removed in Boron
public List<NeutronPort> getPortsInSubnet(String ignore) {
- List<NeutronPort> answer = new ArrayList<NeutronPort>();
+ List<NeutronPort> answer = new ArrayList<>();
for (NeutronPort port : myPorts) {
if (!port.getDeviceOwner().equalsIgnoreCase(ignore)) {
answer.add(port);
if (ipVersion == null) {
ipVersion = IPV4_VERSION;
}
- dnsNameservers = new ArrayList<String>();
+ dnsNameservers = new ArrayList<>();
if (hostRoutes == null) {
- hostRoutes = new ArrayList<NeutronSubnet_HostRoute>();
+ hostRoutes = new ArrayList<>();
}
if (allocationPools == null) {
- allocationPools = new ArrayList<NeutronSubnetIPAllocationPool>();
+ allocationPools = new ArrayList<>();
if (ipVersion == IPV4_VERSION) {
try {
SubnetUtils util = new SubnetUtils(cidr);
* the other ranging from parameter+1 to high
*/
public List<NeutronSubnetIPAllocationPool> splitPool(String ipAddress) {
- List<NeutronSubnetIPAllocationPool> ans = new ArrayList<NeutronSubnetIPAllocationPool>();
+ List<NeutronSubnetIPAllocationPool> ans = new ArrayList<>();
long gIP = NeutronSubnetIPAllocationPool.convert(ipAddress);
long sIP = NeutronSubnetIPAllocationPool.convert(poolStart);
long eIP = NeutronSubnetIPAllocationPool.convert(poolEnd);
* If the pool is a single address, return null
*/
public List<NeutronSubnetIPAllocationPool> splitPoolV6(String ipAddress) {
- List<NeutronSubnetIPAllocationPool> ans = new ArrayList<NeutronSubnetIPAllocationPool>();
+ List<NeutronSubnetIPAllocationPool> ans = new ArrayList<>();
BigInteger gIP = NeutronSubnetIPAllocationPool.convertV6(ipAddress);
BigInteger sIP = NeutronSubnetIPAllocationPool.convertV6(poolStart);
BigInteger eIP = NeutronSubnetIPAllocationPool.convertV6(poolEnd);
@Override
public List<NeutronFloatingIP> getAllFloatingIPs() {
- Set<NeutronFloatingIP> allIPs = new HashSet<NeutronFloatingIP>();
+ Set<NeutronFloatingIP> allIPs = new HashSet<>();
Floatingips fips = readMd(createInstanceIdentifier());
if (fips != null) {
for (Floatingip fip: fips.getFloatingip()) {
}
}
LOGGER.debug("Exiting getAllFloatingIPs, Found {} FloatingIPs", allIPs.size());
- List<NeutronFloatingIP> ans = new ArrayList<NeutronFloatingIP>();
+ List<NeutronFloatingIP> ans = new ArrayList<>();
ans.addAll(allIPs);
return ans;
}
*/
public class NeutronLoadBalancerInterface extends AbstractNeutronInterface<Loadbalancer, NeutronLoadBalancer> implements INeutronLoadBalancerCRUD {
private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerInterface.class);
- private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB = new ConcurrentHashMap<String, NeutronLoadBalancer>();
+ private ConcurrentMap<String, NeutronLoadBalancer> loadBalancerDB = new ConcurrentHashMap<>();
NeutronLoadBalancerInterface(ProviderContext providerContext) {
@Override
public List<NeutronLoadBalancer> getAllNeutronLoadBalancers() {
- Set<NeutronLoadBalancer> allLoadBalancers = new HashSet<NeutronLoadBalancer>();
+ Set<NeutronLoadBalancer> allLoadBalancers = new HashSet<>();
for (Entry<String, NeutronLoadBalancer> entry : loadBalancerDB.entrySet()) {
NeutronLoadBalancer loadBalancer = entry.getValue();
allLoadBalancers.add(loadBalancer);
}
LOGGER.debug("Exiting getLoadBalancers, Found {} OpenStackLoadBalancer", allLoadBalancers.size());
- List<NeutronLoadBalancer> ans = new ArrayList<NeutronLoadBalancer>();
+ List<NeutronLoadBalancer> ans = new ArrayList<>();
ans.addAll(allLoadBalancers);
return ans;
}
public class NeutronLoadBalancerPoolInterface extends AbstractNeutronInterface<Pool, NeutronLoadBalancerPool> implements INeutronLoadBalancerPoolCRUD {
private static final Logger LOGGER = LoggerFactory.getLogger(NeutronLoadBalancerPoolInterface.class);
- private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB = new ConcurrentHashMap<String, NeutronLoadBalancerPool>();
+ private ConcurrentMap<String, NeutronLoadBalancerPool> loadBalancerPoolDB = new ConcurrentHashMap<>();
private static final ImmutableBiMap<Class<? extends ProtocolBase>,String> PROTOCOL_MAP
= new ImmutableBiMap.Builder<Class<? extends ProtocolBase>,String>()
@Override
public List<NeutronLoadBalancerPool> getAllNeutronLoadBalancerPools() {
- Set<NeutronLoadBalancerPool> allLoadBalancerPools = new HashSet<NeutronLoadBalancerPool>();
+ Set<NeutronLoadBalancerPool> allLoadBalancerPools = new HashSet<>();
for (Entry<String, NeutronLoadBalancerPool> entry : loadBalancerPoolDB.entrySet()) {
NeutronLoadBalancerPool loadBalancerPool = entry.getValue();
allLoadBalancerPools.add(loadBalancerPool);
}
LOGGER.debug("Exiting getLoadBalancerPools, Found {} OpenStackLoadBalancerPool", allLoadBalancerPools.size());
- List<NeutronLoadBalancerPool> ans = new ArrayList<NeutronLoadBalancerPool>();
+ List<NeutronLoadBalancerPool> ans = new ArrayList<>();
ans.addAll(allLoadBalancerPools);
return ans;
}
poolBuilder.setLbAlgorithm(pool.getLoadBalancerPoolLbAlgorithm());
}
if (pool.getLoadBalancerPoolListeners() != null) {
- List<Uuid> listListener = new ArrayList<Uuid>();
+ List<Uuid> listListener = new ArrayList<>();
for (Neutron_ID neutron_id : pool.getLoadBalancerPoolListeners()) {
listListener.add(toUuid(neutron_id.getID()));
}
@Override
public List<NeutronNetwork> getAllNetworks() {
- Set<NeutronNetwork> allNetworks = new HashSet<NeutronNetwork>();
+ Set<NeutronNetwork> allNetworks = new HashSet<>();
Networks networks = readMd(createInstanceIdentifier());
if (networks != null) {
for (Network network: networks.getNetwork()) {
}
}
LOGGER.debug("Exiting getAllNetworks, Found {} OpenStackNetworks", allNetworks.size());
- List<NeutronNetwork> ans = new ArrayList<NeutronNetwork>();
+ List<NeutronNetwork> ans = new ArrayList<>();
ans.addAll(allNetworks);
return ans;
}
result.setShared(network.isShared());
result.setStatus(network.getStatus());
if (network.getSubnets() != null) {
- List<String> neutronSubnets = new ArrayList<String>();
+ List<String> neutronSubnets = new ArrayList<>();
for( Uuid subnet : network.getSubnets()) {
neutronSubnets.add(subnet.getValue());
}
result.setProviderPhysicalNetwork(providerExtension.getPhysicalNetwork());
result.setProviderSegmentationID(providerExtension.getSegmentationId());
result.setProviderNetworkType(NETWORK_MAP.get(providerExtension.getNetworkType()));
- List<NeutronNetwork_Segment> segments = new ArrayList<NeutronNetwork_Segment>();
+ List<NeutronNetwork_Segment> segments = new ArrayList<>();
if (providerExtension.getSegments() != null) {
for (Segments segment: providerExtension.getSegments()) {
NeutronNetwork_Segment neutronSegment = new NeutronNetwork_Segment();
providerExtensionBuilder.setNetworkType((Class<? extends NetworkTypeBase>) mapper.get(network.getProviderNetworkType()));
}
if (network.getSegments() != null) {
- List<Segments> segments = new ArrayList<Segments>();
+ List<Segments> segments = new ArrayList<>();
long count = 0;
for( NeutronNetwork_Segment segment : network.getSegments()) {
count++;
networkBuilder.setStatus(network.getStatus());
}
if (network.getSubnets() != null) {
- List<Uuid> subnets = new ArrayList<Uuid>();
+ List<Uuid> subnets = new ArrayList<>();
for( String subnet : network.getSubnets()) {
subnets.add(toUuid(subnet));
}
@Override
public List<NeutronPort> getAllPorts() {
- Set<NeutronPort> allPorts = new HashSet<NeutronPort>();
+ Set<NeutronPort> allPorts = new HashSet<>();
Ports ports = readMd(createInstanceIdentifier());
if (ports != null) {
for (Port port : ports.getPort()) {
}
}
LOGGER.debug("Exiting getAllPorts, Found {} OpenStackPorts", allPorts.size());
- List<NeutronPort> ans = new ArrayList<NeutronPort>();
+ List<NeutronPort> ans = new ArrayList<>();
ans.addAll(allPorts);
return ans;
}
PortBindingExtension binding = port.getAugmentation(PortBindingExtension.class);
result.setBindinghostID(binding.getHostId());
if (binding.getVifDetails() != null) {
- List<NeutronPort_VIFDetail> details = new ArrayList<NeutronPort_VIFDetail>();
+ List<NeutronPort_VIFDetail> details = new ArrayList<>();
for (VifDetails vifDetail : binding.getVifDetails()) {
NeutronPort_VIFDetail detail = new NeutronPort_VIFDetail();
detail.setPortFilter(vifDetail.isPortFilter());
NeutronPort result = new NeutronPort();
result.setAdminStateUp(port.isAdminStateUp());
if (port.getAllowedAddressPairs() != null) {
- List<NeutronPort_AllowedAddressPairs> pairs = new ArrayList<NeutronPort_AllowedAddressPairs>();
+ List<NeutronPort_AllowedAddressPairs> pairs = new ArrayList<>();
for (AllowedAddressPairs mdPair : port.getAllowedAddressPairs()) {
NeutronPort_AllowedAddressPairs pair = new NeutronPort_AllowedAddressPairs();
pair.setIpAddress(mdPair.getIpAddress());
result.setDeviceID(port.getDeviceId());
result.setDeviceOwner(port.getDeviceOwner());
if (port.getExtraDhcpOpts() != null) {
- List<NeutronPort_ExtraDHCPOption> options = new ArrayList<NeutronPort_ExtraDHCPOption>();
+ List<NeutronPort_ExtraDHCPOption> options = new ArrayList<>();
for (ExtraDhcpOpts opt : port.getExtraDhcpOpts()) {
NeutronPort_ExtraDHCPOption arg = new NeutronPort_ExtraDHCPOption();
arg.setName(opt.getOptName());
result.setExtraDHCPOptions(options);
}
if (port.getFixedIps() != null) {
- List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> ips = new ArrayList<>();
for (FixedIps mdIP : port.getFixedIps()) {
Neutron_IPs ip = new Neutron_IPs();
ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue()));
result.setName(port.getName());
result.setNetworkUUID(String.valueOf(port.getNetworkId().getValue()));
if (port.getSecurityGroups() != null) {
- Set<NeutronSecurityGroup> allGroups = new HashSet<NeutronSecurityGroup>();
+ Set<NeutronSecurityGroup> allGroups = new HashSet<>();
NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this);
INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface();
for (Uuid sgUuid : port.getSecurityGroups()) {
allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
}
- List<NeutronSecurityGroup> groups = new ArrayList<NeutronSecurityGroup>();
+ List<NeutronSecurityGroup> groups = new ArrayList<>();
groups.addAll(allGroups);
result.setSecurityGroups(groups);
}
bindingBuilder.setHostId(neutronPort.getBindinghostID());
}
if (neutronPort.getVIFDetail() != null) {
- List<VifDetails> listVifDetail = new ArrayList<VifDetails>();
+ List<VifDetails> listVifDetail = new ArrayList<>();
for (NeutronPort_VIFDetail detail: neutronPort.getVIFDetail()) {
VifDetailsBuilder vifDetailsBuilder = new VifDetailsBuilder();
if (detail.getPortFilter() != null) {
bindingBuilder.build());
portBuilder.setAdminStateUp(neutronPort.isAdminStateUp());
if(neutronPort.getAllowedAddressPairs() != null) {
- List<AllowedAddressPairs> listAllowedAddressPairs = new ArrayList<AllowedAddressPairs>();
+ List<AllowedAddressPairs> listAllowedAddressPairs = new ArrayList<>();
for (NeutronPort_AllowedAddressPairs allowedAddressPairs : neutronPort.getAllowedAddressPairs()) {
AllowedAddressPairsBuilder allowedAddressPairsBuilder = new AllowedAddressPairsBuilder();
allowedAddressPairsBuilder.setIpAddress(allowedAddressPairs.getIpAddress());
portBuilder.setDeviceOwner(neutronPort.getDeviceOwner());
}
if (neutronPort.getExtraDHCPOptions() != null) {
- List<ExtraDhcpOpts> listExtraDHCPOptions = new ArrayList<ExtraDhcpOpts>();
+ List<ExtraDhcpOpts> listExtraDHCPOptions = new ArrayList<>();
for (NeutronPort_ExtraDHCPOption extraDHCPOption : neutronPort.getExtraDHCPOptions()) {
ExtraDhcpOptsBuilder extraDHCPOptsBuilder = new ExtraDhcpOptsBuilder();
extraDHCPOptsBuilder.setOptName(extraDHCPOption.getName());
portBuilder.setExtraDhcpOpts(listExtraDHCPOptions);
}
if (neutronPort.getFixedIPs() != null) {
- List<FixedIps> listNeutronIPs = new ArrayList<FixedIps>();
+ List<FixedIps> listNeutronIPs = new ArrayList<>();
for (Neutron_IPs neutron_IPs : neutronPort.getFixedIPs()) {
FixedIpsBuilder fixedIpsBuilder = new FixedIpsBuilder();
fixedIpsBuilder.setIpAddress(new IpAddress(neutron_IPs.getIpAddress().toCharArray()));
portBuilder.setNetworkId(toUuid(neutronPort.getNetworkUUID()));
}
if (neutronPort.getSecurityGroups() != null) {
- List<Uuid> listSecurityGroups = new ArrayList<Uuid>();
+ List<Uuid> listSecurityGroups = new ArrayList<>();
for (NeutronSecurityGroup neutronSecurityGroup : neutronPort.getSecurityGroups()) {
listSecurityGroups.add(toUuid(neutronSecurityGroup.getID()));
}
@Override
public List<NeutronRouter> getAllRouters() {
- Set<NeutronRouter> allRouters = new HashSet<NeutronRouter>();
+ Set<NeutronRouter> allRouters = new HashSet<>();
Routers routers = readMd(createInstanceIdentifier());
if (routers != null) {
for (Router router: routers.getRouter()) {
}
}
LOGGER.debug("Exiting getAllRouters, Found {} Routers", allRouters.size());
- List<NeutronRouter> ans = new ArrayList<NeutronRouter>();
+ List<NeutronRouter> ans = new ArrayList<>();
ans.addAll(allRouters);
return ans;
}
routerBuilder.setAdminStateUp(router.getAdminStateUp());
routerBuilder.setDistributed(router.getDistributed());
if (router.getRoutes() != null) {
- List<String> routes = new ArrayList<String>();
+ List<String> routes = new ArrayList<>();
for (String route : router.getRoutes()) {
routes.add(route);
}
}
if (router.getExternalGatewayInfo() != null) {
ExternalGatewayInfo externalGatewayInfo = null;
- List<NeutronRouter_NetworkReference> neutronRouter_NetworkReferences = new ArrayList<NeutronRouter_NetworkReference>();
+ List<NeutronRouter_NetworkReference> neutronRouter_NetworkReferences = new ArrayList<>();
neutronRouter_NetworkReferences.add(router.getExternalGatewayInfo());
for (NeutronRouter_NetworkReference externalGatewayInfos : neutronRouter_NetworkReferences) {
ExternalGatewayInfoBuilder builder = new ExternalGatewayInfoBuilder();
builder.setEnableSnat(externalGatewayInfos.getEnableSNAT());
builder.setExternalNetworkId(toUuid(externalGatewayInfos.getNetworkID()));
if (externalGatewayInfos.getExternalFixedIPs() != null) {
- List<ExternalFixedIps> externalFixedIps = new ArrayList<ExternalFixedIps>();
+ List<ExternalFixedIps> externalFixedIps = new ArrayList<>();
for (Neutron_IPs eIP : externalGatewayInfos.getExternalFixedIPs()) {
ExternalFixedIpsBuilder eFixedIpBuilder = new ExternalFixedIpsBuilder();
eFixedIpBuilder.setIpAddress(new IpAddress(eIP.getIpAddress().toCharArray()));
routerBuilder.setExternalGatewayInfo(externalGatewayInfo);
}
if (router.getInterfaces() != null) {
- Map<String, NeutronRouter_Interface> mapInterfaces = new HashMap<String, NeutronRouter_Interface>();
- List<Interfaces> interfaces = new ArrayList<Interfaces>();
+ Map<String, NeutronRouter_Interface> mapInterfaces = new HashMap<>();
+ List<Interfaces> interfaces = new ArrayList<>();
for (Entry<String, NeutronRouter_Interface> entry : mapInterfaces.entrySet()) {
interfaces.add((Interfaces) entry.getValue());
}
result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue()));
}
if (router.getRoutes() != null) {
- List<String> routes = new ArrayList<String>();
+ List<String> routes = new ArrayList<>();
for (String route : router.getRoutes()) {
routes.add(route);
}
extGwInfo.setNetworkID(String.valueOf(router.getExternalGatewayInfo().getExternalNetworkId().getValue()));
extGwInfo.setEnableSNAT(router.getExternalGatewayInfo().isEnableSnat());
if (router.getExternalGatewayInfo().getExternalFixedIps() != null) {
- List<Neutron_IPs> fixedIPs = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> fixedIPs = new ArrayList<>();
for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) {
Neutron_IPs fixedIP = new Neutron_IPs();
fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue()));
}
if (router.getInterfaces() != null) {
- Map<String, NeutronRouter_Interface> interfaces = new HashMap<String, NeutronRouter_Interface>();
+ Map<String, NeutronRouter_Interface> interfaces = new HashMap<>();
for (Interfaces mdInterface : router.getInterfaces()) {
NeutronRouter_Interface pojoInterface = new NeutronRouter_Interface();
String id = String.valueOf(mdInterface.getUuid().getValue());
@Override
public List<NeutronSecurityGroup> getAllNeutronSecurityGroups() {
- Set<NeutronSecurityGroup> allSecurityGroups = new HashSet<NeutronSecurityGroup>();
+ Set<NeutronSecurityGroup> allSecurityGroups = new HashSet<>();
SecurityGroups groups = readMd(createInstanceIdentifier());
if (groups != null) {
for (SecurityGroup group: groups.getSecurityGroup()) {
}
}
LOGGER.debug("Exiting getSecurityGroups, Found {} OpenStackSecurityGroup", allSecurityGroups.size());
- List<NeutronSecurityGroup> ans = new ArrayList<NeutronSecurityGroup>();
+ List<NeutronSecurityGroup> ans = new ArrayList<>();
ans.addAll(allSecurityGroups);
return ans;
}
.fetchINeutronSecurityRuleCRUD(this);
INeutronSecurityRuleCRUD srCrud = interfaces.getSecurityRuleInterface();
- List<NeutronSecurityRule> rules = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> rules = new ArrayList<>();
for (Uuid uuid: group.getSecurityRules()) {
rules.add(srCrud.getNeutronSecurityRule(uuid.getValue()));
}
securityGroupBuilder.setTenantId(toUuid(securityGroup.getSecurityGroupTenantID()));
}
if (securityGroup.getSecurityRules() != null) {
- List<Uuid> neutronSecurityRule = new ArrayList<Uuid>();
+ List<Uuid> neutronSecurityRule = new ArrayList<>();
for (NeutronSecurityRule securityRule : securityGroup.getSecurityRules()) {
if (securityRule.getID() != null) {
neutronSecurityRule.add(toUuid(securityRule.getID()));
INeutronSecurityGroupCRUD sgCrud = interfaces.getSecurityGroupInterface();
NeutronSecurityGroup sg = sgCrud.getNeutronSecurityGroup(input.getSecurityRuleGroupID());
if(sg != null && sg.getSecurityRules() != null) {
- List<NeutronSecurityRule> toRemove = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> toRemove = new ArrayList<>();
for(NeutronSecurityRule sgr :sg.getSecurityRules()) {
if(sgr.getID() != null && sgr.getID().equals(input.getID())) {
toRemove.add(sgr);
@Override
public List<NeutronSecurityRule> getAllNeutronSecurityRules() {
- Set<NeutronSecurityRule> allSecurityRules = new HashSet<NeutronSecurityRule>();
+ Set<NeutronSecurityRule> allSecurityRules = new HashSet<>();
SecurityRules rules = readMd(createInstanceIdentifier());
if (rules != null) {
for (SecurityRule rule: rules.getSecurityRule()) {
}
}
LOGGER.debug("Exiting getSecurityRule, Found {} OpenStackSecurityRule", allSecurityRules.size());
- List<NeutronSecurityRule> ans = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> ans = new ArrayList<>();
ans.addAll(allSecurityRules);
return ans;
}
@Override
public List<NeutronSubnet> getAllSubnets() {
- Set<NeutronSubnet> allSubnets = new HashSet<NeutronSubnet>();
+ Set<NeutronSubnet> allSubnets = new HashSet<>();
Subnets subnets = readMd(createInstanceIdentifier());
if (subnets != null) {
for (Subnet subnet: subnets.getSubnet()) {
}
}
LOGGER.debug("Exiting getAllSubnets, Found {} OpenStackSubnets", allSubnets.size());
- List<NeutronSubnet> ans = new ArrayList<NeutronSubnet>();
+ List<NeutronSubnet> ans = new ArrayList<>();
ans.addAll(allSubnets);
return ans;
}
result.setIpV6AddressMode(DHCPV6_MAP.get(subnet.getIpv6AddressMode()));
result.setEnableDHCP(subnet.isEnableDhcp());
if (subnet.getAllocationPools() != null) {
- List<NeutronSubnetIPAllocationPool> allocationPools = new ArrayList<NeutronSubnetIPAllocationPool>();
+ List<NeutronSubnetIPAllocationPool> allocationPools = new ArrayList<>();
for (AllocationPools allocationPool : subnet.getAllocationPools()) {
NeutronSubnetIPAllocationPool pool = new NeutronSubnetIPAllocationPool();
pool.setPoolStart(allocationPool.getStart());
result.setAllocationPools(allocationPools);
}
if (subnet.getDnsNameservers() != null) {
- List<String> dnsNameServers = new ArrayList<String>();
+ List<String> dnsNameServers = new ArrayList<>();
for (IpAddress dnsNameServer : subnet.getDnsNameservers()) {
dnsNameServers.add(String.valueOf(dnsNameServer.getValue()));
}
// read through the ports and put the ones in this subnet into the internal
// myPorts object.
// @deprecated and will be removed in Boron
- Set<NeutronPort> allPorts = new HashSet<NeutronPort>();
+ Set<NeutronPort> allPorts = new HashSet<>();
NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces()
.fetchINeutronPortCRUD(this);
INeutronPortCRUD portIf = interfaces.getPortInterface();
}
}
}
- List<NeutronPort> ports = new ArrayList<NeutronPort>();
+ List<NeutronPort> ports = new ArrayList<>();
ports.addAll(allPorts);
result.setPorts(ports);
return result;
}
subnetBuilder.setEnableDhcp(subnet.getEnableDHCP());
if (subnet.getAllocationPools() != null) {
- List<AllocationPools> allocationPools = new ArrayList<AllocationPools>();
+ List<AllocationPools> allocationPools = new ArrayList<>();
for (NeutronSubnetIPAllocationPool allocationPool : subnet
.getAllocationPools()) {
AllocationPoolsBuilder builder = new AllocationPoolsBuilder();
subnetBuilder.setAllocationPools(allocationPools);
}
if (subnet.getDnsNameservers() != null) {
- List<IpAddress> dnsNameServers = new ArrayList<IpAddress>();
+ List<IpAddress> dnsNameServers = new ArrayList<>();
for (String dnsNameServer : subnet.getDnsNameservers()) {
IpAddress ipAddress = new IpAddress(dnsNameServer.toCharArray());
dnsNameServers.add(ipAddress);
result.setShared(network.isShared());
result.setStatus(network.getStatus());
if (network.getSubnets() != null) {
- List<String> neutronSubnets = new ArrayList<String>();
+ List<String> neutronSubnets = new ArrayList<>();
for( Uuid subnet : network.getSubnets()) {
neutronSubnets.add(subnet.getValue());
}
result.setProviderPhysicalNetwork(providerExtension.getPhysicalNetwork());
result.setProviderSegmentationID(providerExtension.getSegmentationId());
result.setProviderNetworkType(NETWORK_MAP.get(providerExtension.getNetworkType()));
- List<NeutronNetwork_Segment> segments = new ArrayList<NeutronNetwork_Segment>();
+ List<NeutronNetwork_Segment> segments = new ArrayList<>();
if (providerExtension.getSegments() != null) {
for (Segments segment: providerExtension.getSegments()) {
NeutronNetwork_Segment neutronSegment = new NeutronNetwork_Segment();
NeutronPort result = new NeutronPort();
result.setAdminStateUp(port.isAdminStateUp());
if (port.getAllowedAddressPairs() != null) {
- List<NeutronPort_AllowedAddressPairs> pairs = new ArrayList<NeutronPort_AllowedAddressPairs>();
+ List<NeutronPort_AllowedAddressPairs> pairs = new ArrayList<>();
for (AllowedAddressPairs mdPair : port.getAllowedAddressPairs()) {
NeutronPort_AllowedAddressPairs pair = new NeutronPort_AllowedAddressPairs();
pair.setIpAddress(mdPair.getIpAddress());
result.setDeviceID(port.getDeviceId());
result.setDeviceOwner(port.getDeviceOwner());
if (port.getExtraDhcpOpts() != null) {
- List<NeutronPort_ExtraDHCPOption> options = new ArrayList<NeutronPort_ExtraDHCPOption>();
+ List<NeutronPort_ExtraDHCPOption> options = new ArrayList<>();
for (ExtraDhcpOpts opt : port.getExtraDhcpOpts()) {
NeutronPort_ExtraDHCPOption arg = new NeutronPort_ExtraDHCPOption();
arg.setName(opt.getOptName());
result.setExtraDHCPOptions(options);
}
if (port.getFixedIps() != null) {
- List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> ips = new ArrayList<>();
for (FixedIps mdIP : port.getFixedIps()) {
Neutron_IPs ip = new Neutron_IPs();
ip.setIpAddress(String.valueOf(mdIP.getIpAddress().getValue()));
result.setName(port.getName());
result.setNetworkUUID(String.valueOf(port.getNetworkId().getValue()));
if (port.getSecurityGroups() != null) {
- Set<NeutronSecurityGroup> allGroups = new HashSet<NeutronSecurityGroup>();
+ Set<NeutronSecurityGroup> allGroups = new HashSet<>();
NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this);
INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface();
for (Uuid sgUuid : port.getSecurityGroups()) {
allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
}
- List<NeutronSecurityGroup> groups = new ArrayList<NeutronSecurityGroup>();
+ List<NeutronSecurityGroup> groups = new ArrayList<>();
groups.addAll(allGroups);
result.setSecurityGroups(groups);
}
PortBindingExtension binding = port.getAugmentation(PortBindingExtension.class);
result.setBindinghostID(binding.getHostId());
if (binding.getVifDetails() != null) {
- List<NeutronPort_VIFDetail> details = new ArrayList<NeutronPort_VIFDetail>();
+ List<NeutronPort_VIFDetail> details = new ArrayList<>();
for (VifDetails vifDetail : binding.getVifDetails()) {
NeutronPort_VIFDetail detail = new NeutronPort_VIFDetail();
detail.setPortFilter(vifDetail.isPortFilter());
private Map<String,NeutronPort> getChangedPorts(Map<InstanceIdentifier<?>, DataObject> changedData) {
LOG.trace("getChangedPorts:" + changedData);
- Map<String,NeutronPort> portMap = new HashMap<String,NeutronPort>();
+ Map<String,NeutronPort> portMap = new HashMap<>();
for (Map.Entry<InstanceIdentifier<?>, DataObject> changed : changedData.entrySet()) {
if (changed.getValue() instanceof Port) {
NeutronPort port = fromMd((Port)changed.getValue());
result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue()));
}
if (router.getRoutes() != null) {
- List<String> routes = new ArrayList<String>();
+ List<String> routes = new ArrayList<>();
for (String route : router.getRoutes()) {
routes.add(route);
}
extGwInfo.setNetworkID(String.valueOf(router.getExternalGatewayInfo().getExternalNetworkId().getValue()));
extGwInfo.setEnableSNAT(router.getExternalGatewayInfo().isEnableSnat());
if (router.getExternalGatewayInfo().getExternalFixedIps() != null) {
- List<Neutron_IPs> fixedIPs = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> fixedIPs = new ArrayList<>();
for (ExternalFixedIps mdFixedIP : router.getExternalGatewayInfo().getExternalFixedIps()) {
Neutron_IPs fixedIP = new Neutron_IPs();
fixedIP.setSubnetUUID(String.valueOf(mdFixedIP.getSubnetId().getValue()));
}
if (router.getInterfaces() != null) {
- Map<String, NeutronRouter_Interface> interfaces = new HashMap<String, NeutronRouter_Interface>();
+ Map<String, NeutronRouter_Interface> interfaces = new HashMap<>();
for (Interfaces mdInterface : router.getInterfaces()) {
NeutronRouter_Interface pojoInterface = new NeutronRouter_Interface();
String id = String.valueOf(mdInterface.getUuid().getValue());
INeutronSecurityRuleCRUD srCrud = interfaces
.getSecurityRuleInterface();
- List<NeutronSecurityRule> rules = new ArrayList<NeutronSecurityRule>();
+ List<NeutronSecurityRule> rules = new ArrayList<>();
for (Uuid uuid : group.getSecurityRules()) {
rules.add(srCrud.getNeutronSecurityRule(uuid.getValue()));
}
result.setIpV6AddressMode(DHCPV6_MAP.get(subnet.getIpv6AddressMode()));
result.setEnableDHCP(subnet.isEnableDhcp());
if (subnet.getAllocationPools() != null) {
- List<NeutronSubnetIPAllocationPool> allocationPools = new ArrayList<NeutronSubnetIPAllocationPool>();
+ List<NeutronSubnetIPAllocationPool> allocationPools = new ArrayList<>();
for (AllocationPools allocationPool : subnet.getAllocationPools()) {
NeutronSubnetIPAllocationPool pool = new NeutronSubnetIPAllocationPool();
pool.setPoolStart(allocationPool.getStart());
result.setAllocationPools(allocationPools);
}
if (subnet.getDnsNameservers() != null) {
- List<String> dnsNameServers = new ArrayList<String>();
+ List<String> dnsNameServers = new ArrayList<>();
for (IpAddress dnsNameServer : subnet.getDnsNameservers()) {
dnsNameServers.add(String.valueOf(dnsNameServer.getValue()));
}
// read through the ports and put the ones in this subnet into the internal
// myPorts object.
- Set<NeutronPort> allPorts = new HashSet<NeutronPort>();
+ Set<NeutronPort> allPorts = new HashSet<>();
NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces()
.fetchINeutronPortCRUD(this);
INeutronPortCRUD portIf = interfaces.getPortInterface();
}
}
}
- List<NeutronPort> ports = new ArrayList<NeutronPort>();
+ List<NeutronPort> ports = new ArrayList<>();
ports.addAll(allPorts);
result.setPorts(ports);
return result;
public void setUp() {
when(neutronLBPool.getLoadBalancerPoolProtocol()).thenReturn(LoadBalancerConfiguration.PROTOCOL_HTTP);
- List<NeutronLoadBalancerPoolMember> members = new ArrayList<NeutronLoadBalancerPoolMember>();
+ List<NeutronLoadBalancerPoolMember> members = new ArrayList<>();
NeutronLoadBalancerPoolMember neutronLBPoolMember = mock(NeutronLoadBalancerPoolMember.class);
when(neutronLBPoolMember.getPoolMemberAdminStateIsUp()).thenReturn(true);
when(neutronLBPoolMember.getPoolMemberSubnetID()).thenReturn("subnetID");
members.add(neutronLBPoolMember);
when(neutronLBPool.getLoadBalancerPoolMembers()).thenReturn(members);
- List<NeutronLoadBalancer> list_neutronLB = new ArrayList<NeutronLoadBalancer>();
+ List<NeutronLoadBalancer> list_neutronLB = new ArrayList<>();
NeutronLoadBalancer neutronLB = mock(NeutronLoadBalancer.class);
when(neutronLB.getLoadBalancerName()).thenReturn("load_balancer_name");
when(neutronLB.getLoadBalancerVipAddress()).thenReturn("vip_address");
NorthboundEvent ev = mock(NorthboundEvent.class);
when(ev.getLoadBalancerPool()).thenReturn(neutronLBPool);
- List<Node> list_node = new ArrayList<Node>();
+ List<Node> list_node = new ArrayList<>();
list_node .add(mock(Node.class));
when(nodeCacheManager.getBridgeNodes()).thenReturn(list_node);
when(NeutronCacheUtils.getMacAddress(any(INeutronPortCRUD.class), anyString(), anyString())).thenReturn("mac_address");
when(NeutronCacheUtils.getProviderInformation(any(INeutronNetworkCRUD.class), any(INeutronSubnetCRUD.class), anyString())).thenReturn(providerInfo);
- List<NeutronLoadBalancerPoolMember> members = new ArrayList<NeutronLoadBalancerPoolMember>();
+ List<NeutronLoadBalancerPoolMember> members = new ArrayList<>();
NeutronLoadBalancerPoolMember neutronLBPoolMember = mock(NeutronLoadBalancerPoolMember.class);
when(neutronLBPoolMember.getPoolMemberAdminStateIsUp()).thenReturn(true);
when(neutronLBPoolMember.getPoolMemberSubnetID()).thenReturn("subnetID");
when(neutronLBPool.getLoadBalancerPoolMembers()).thenReturn(members);
when(neutronLBPoolCache.getNeutronLoadBalancerPool(anyString())).thenReturn(neutronLBPool);
- List<NeutronLoadBalancer> list_neutronLB = new ArrayList<NeutronLoadBalancer>();
+ List<NeutronLoadBalancer> list_neutronLB = new ArrayList<>();
NeutronLoadBalancer neutronLB = mock(NeutronLoadBalancer.class);
when(neutronLB.getLoadBalancerName()).thenReturn("load_balancer_name");
when(neutronLB.getLoadBalancerVipAddress()).thenReturn("vip_address");
NorthboundEvent ev = mock(NorthboundEvent.class);
when(ev.getLoadBalancerPoolMember()).thenReturn(neutronLBMember);
- List<Node> list_node = new ArrayList<Node>();
+ List<Node> list_node = new ArrayList<>();
list_node .add(mock(Node.class));
when(nodeCacheManager.getBridgeNodes()).thenReturn(list_node);
Neutron_IPs ip = mock(Neutron_IPs.class);
when(ip.getIpAddress()).thenReturn("ip_address");
when(ip.getSubnetUUID()).thenReturn("subnetUUID");
- List<Neutron_IPs> list_fixedIP = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> list_fixedIP = new ArrayList<>();
list_fixedIP.add(ip);
when(port.getFixedIPs()).thenReturn(list_fixedIP);
when(port.getMacAddress()).thenReturn("mac_address");
- List<NeutronPort> list_port = new ArrayList<NeutronPort>();
+ List<NeutronPort> list_port = new ArrayList<>();
list_port.add(port);
when(neutronPortsCache.getAllPorts()).thenReturn(list_port);
NeutronSubnet subnet = mock(NeutronSubnet.class);
when(subnet.getID()).thenReturn("subnetUUID");
when(subnet.getNetworkUUID()).thenReturn("networkUUID");
- List<NeutronSubnet> list_subnet = new ArrayList<NeutronSubnet>();
+ List<NeutronSubnet> list_subnet = new ArrayList<>();
list_subnet.add(subnet);
when(neutronSubnetCache.getAllSubnets()).thenReturn(list_subnet );
when(network.getID()).thenReturn("networkUUID");
when(network.getProviderNetworkType()).thenReturn("network_type_1");
when(network.getProviderSegmentationID()).thenReturn("network_segID");
- List<NeutronNetwork> list_network = new ArrayList<NeutronNetwork>();
+ List<NeutronNetwork> list_network = new ArrayList<>();
list_network.add(network);
when(neutronNetworkCache.getAllNetworks()).thenReturn(list_network);
- Map.Entry<String,String> entry = new AbstractMap.SimpleEntry<String, String>(
+ Map.Entry<String,String> entry = new AbstractMap.SimpleEntry<>(
network.getProviderNetworkType(), network.getProviderSegmentationID());
assertEquals("Error, getProviderInformation() did not return the correct values", entry, NeutronCacheUtils.getProviderInformation(neutronNetworkCache, neutronSubnetCache, "subnetUUID"));
portHandlerSpy.processEvent(ev);
verify(neutronL3Adapter, times(1)).handleNeutronPortEvent(neutronPort, Action.UPDATE);
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
nodes.add(mock(Node.class));
when(nodeCacheManager.getNodes()).thenReturn(nodes);
- List<OvsdbTerminationPointAugmentation> ports = new ArrayList<OvsdbTerminationPointAugmentation>();
+ List<OvsdbTerminationPointAugmentation> ports = new ArrayList<>();
OvsdbTerminationPointAugmentation port = mock(OvsdbTerminationPointAugmentation.class);
ports.add(port);
when(southbound.getTerminationPointsOfBridge(any(Node.class))).thenReturn(ports);
Node node = mock(Node.class);
when(node.getAugmentation(OvsdbNodeAugmentation.class)).thenReturn(mock(OvsdbNodeAugmentation.class));
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
nodes.add(mock(Node.class));
when(southbound.readOvsdbTopologyNodes()).thenReturn(nodes);
when(ev.getType()).thenReturn(Type.OPENVSWITCH);
when(ovsdbTerminationPointAugmentation.getName()).thenReturn("network");
- List<TerminationPoint> terminationPoints = new ArrayList<TerminationPoint>();
+ List<TerminationPoint> terminationPoints = new ArrayList<>();
terminationPoints.add(mock(TerminationPoint.class));
when(southbound.extractTerminationPoints(any(Node.class))).thenReturn(terminationPoints);
@Test
public void testHandleNeutronPortEvent() throws Exception {
- Map<String, NeutronRouter_Interface> subnetIdToRouterInterfaceCache = new HashMap<String, NeutronRouter_Interface>();
+ Map<String, NeutronRouter_Interface> subnetIdToRouterInterfaceCache = new HashMap<>();
// Mock variables
Neutron_IPs neutronIP = mock(Neutron_IPs.class);
when(neutronIP.getSubnetUUID()).thenReturn(UUID);
- List<Neutron_IPs> list_neutronIP = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> list_neutronIP = new ArrayList<>();
list_neutronIP.add(neutronIP);
NeutronPort neutronPort = mock(NeutronPort.class);
when(neutronPort.getDeviceOwner()).thenReturn(OWNER_ROUTER_INTERFACE);
Neutron_IPs neutronIP = mock(Neutron_IPs.class);
when(neutronIP.getSubnetUUID()).thenReturn(UUID);
NeutronPort neutronPort = mock(NeutronPort.class);
- List<Neutron_IPs> list_neutronIP = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> list_neutronIP = new ArrayList<>();
list_neutronIP.add(neutronIP);
when(neutronPort.getFixedIPs()).thenReturn(list_neutronIP);
List<NeutronPort> list_neutronPort = new ArrayList<>();
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testProgramFlowsForFloatingIPArpAdd() throws Exception {
- Map<String, Pair> neutronPortToDpIdCache = new HashMap<String, Pair>();
- Map<String, String> networkIdToRouterMacCache = new HashMap<String, String>();
+ Map<String, Pair> neutronPortToDpIdCache = new HashMap<>();
+ Map<String, String> networkIdToRouterMacCache = new HashMap<>();
Map floatIpDataMapCache = new HashMap();
NeutronFloatingIP neutronFloatingIP = mock(NeutronFloatingIP.class);
ConfigurationService configurationService = mock(ConfigurationService.class);
when(configurationService.getPatchPortName(any(Pair.class))).thenReturn(PORT_INT);
MemberModifier.field(NeutronL3Adapter.class, "configurationService").set(neutronL3Adapter , configurationService);
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
nodes.add(mock(Node.class));
NodeCacheManager nodeCacheManager = mock(NodeCacheManager.class);
when(nodeCacheManager.getBridgeNodes()).thenReturn(nodes);
@Test
public void testHandleInterfaceEvent() throws Exception {
- Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<String, Pair<Long,Uuid>>();
+ Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<>();
// init instance variables
TenantNetworkManager tenantNetworkManager = mock(TenantNetworkManager.class);
MemberModifier.field(NeutronL3Adapter.class, "tenantNetworkManager").set(neutronL3Adapter , tenantNetworkManager);
@Test
public void testHandleInterfaceEventAdd() throws Exception {
- Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<String, Pair<Long,Uuid>>();
+ Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<>();
// init instance variables
MemberModifier.field(NeutronL3Adapter.class, "neutronPortToDpIdCache").set(neutronL3Adapter , neutronPortToDpIdCache);
int temp = neutronPortToDpIdCache.size();
@SuppressWarnings("unchecked")
@Test
public void testHandleInterfaceEventDelete() throws Exception {
- Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<String, Pair<Long,Uuid>>();
+ Map<String, Pair<Long, Uuid>> neutronPortToDpIdCache = new HashMap<>();
OvsdbTerminationPointAugmentation intf = mock(OvsdbTerminationPointAugmentation.class);
Uuid uuid = mock(Uuid.class);
when(intf.getInterfaceUuid()).thenReturn(uuid );
@Test
public void testUpdateL3ForNeutronPort() throws Exception {
- Map<String, String> networkIdToRouterMacCache = new HashMap<String, String>();
+ Map<String, String> networkIdToRouterMacCache = new HashMap<>();
Neutron_IPs neutronIp = mock(Neutron_IPs.class);
when(neutronIp.getIpAddress()).thenReturn(FIXED_IP_ADDRESS);
- List<Neutron_IPs> neutronIps = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> neutronIps = new ArrayList<>();
neutronIps.add(neutronIp);
NeutronPort neutronPort = mock(NeutronPort.class);
when(neutronPort.getNetworkUUID()).thenReturn(UUID);
when(neutronPort.getFixedIPs()).thenReturn(neutronIps);
NeutronNetwork neutronNetwork = mock(NeutronNetwork.class);
when(neutronNetwork.getProviderSegmentationID()).thenReturn(ID);
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
nodes.add(mock(Node.class));
PowerMockito.doReturn(Long.valueOf(15)).when(neutronL3Adapter, "getDpidForIntegrationBridge", any(Node.class));
// either add or remove item in l3ForwardingCache
@Test
public void testProgramL3ForwardingStage1() throws Exception {
- Set<String> l3ForwardingCache = new HashSet<String>();
+ Set<String> l3ForwardingCache = new HashSet<>();
NodeId nodeId = mock(NodeId.class);
when(nodeId.getValue()).thenReturn(ID);
@Test
public void testProgramFlowsForNeutronRouterInterface() throws Exception {
- Map<String, String> networkIdToRouterMacCache = new HashMap<String, String>();
- Map<String, List<Neutron_IPs>> networkIdToRouterIpListCache = new HashMap<String, List<Neutron_IPs>>();
- Map<String, NeutronRouter_Interface> subnetIdToRouterInterfaceCache = new HashMap<String, NeutronRouter_Interface>();
+ Map<String, String> networkIdToRouterMacCache = new HashMap<>();
+ Map<String, List<Neutron_IPs>> networkIdToRouterIpListCache = new HashMap<>();
+ Map<String, NeutronRouter_Interface> subnetIdToRouterInterfaceCache = new HashMap<>();
NeutronRouter_Interface intf = mock(NeutronRouter_Interface.class);
when(intf.getPortUUID()).thenReturn(UUID);
when(intf.getSubnetUUID()).thenReturn(UUID);
Neutron_IPs neutronIp = mock(Neutron_IPs.class);
when(neutronIp.getIpAddress()).thenReturn(FIXED_IP_ADDRESS);
- List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> ips = new ArrayList<>();
ips.add(neutronIp);
NeutronPort neutronPort = mock(NeutronPort.class);
when(neutronPort.getMacAddress()).thenReturn(MAC_ADDRESS);
NeutronRouter neutronRouter = mock(NeutronRouter.class);
Node node = mock(Node.class);
- List<Node> nodes = new ArrayList<Node>();
+ List<Node> nodes = new ArrayList<>();
nodes.add(node);
MemberModifier.suppress(MemberMatcher.method(NeutronL3Adapter.class, "getDpidForIntegrationBridge", Node.class));
when(neutronNetwork.getProviderSegmentationID()).thenReturn(ID);
Neutron_IPs ip = mock(Neutron_IPs.class);
when(ip.getIpAddress()).thenReturn(IP);
- List<Neutron_IPs> ips = new ArrayList<Neutron_IPs>();
+ List<Neutron_IPs> ips = new ArrayList<>();
ips.add(ip);
ips.add(ip);
ips.add(ip);
@Test
public void testProgramRouterInterfaceStage1() throws Exception {
- Set<String> routerInterfacesCache = new HashSet<String>();
+ Set<String> routerInterfacesCache = new HashSet<>();
NodeId nodeId = mock(NodeId.class);
when(nodeId.getValue()).thenReturn(ID);
//either add or remove staticArpEntryCache
@Test
public void testProgramStaticArpStage1() throws Exception {
- Set<String> staticArpEntryCache = new HashSet<String>();
+ Set<String> staticArpEntryCache = new HashSet<>();
MemberModifier.suppress(MemberMatcher.method(NeutronL3Adapter.class, "programStaticArpStage2", Long.class, String.class, String.class, String.class, Action.class));
// either add or remove inboundIpRewriteCache
@Test
public void testProgramInboundIpRewriteStage1() throws Exception {
- Set<String> inboundIpRewriteCache = new HashSet<String>();
+ Set<String> inboundIpRewriteCache = new HashSet<>();
MemberModifier.suppress(MemberMatcher.method(NeutronL3Adapter.class, "programInboundIpRewriteStage2", Long.class, Long.class, String.class, String.class, String.class, Action.class));
// either add or remove outboundIpRewriteExclusionCache
@Test
public void testProgramIpRewriteExclusionStage1() throws Exception {
- Set<String> outboundIpRewriteExclusionCache = new HashSet<String>();
+ Set<String> outboundIpRewriteExclusionCache = new HashSet<>();
NodeId nodeId = mock(NodeId.class);
when(nodeId.getValue()).thenReturn(ID);
@SuppressWarnings("unchecked")
@Test
public void testProgramOutboundIpRewriteStage1() throws Exception{
- Set<String> outboundIpRewriteCache = new HashSet<String>();
+ Set<String> outboundIpRewriteCache = new HashSet<>();
MemberModifier.suppress(MemberMatcher.method(NeutronL3Adapter.class, "programOutboundIpRewriteStage2", floatingIpClass, Action.class));
public void setUp(){
NeutronPort neutronPort = mock(NeutronPort.class);
- List<NeutronSecurityGroup> securityGroups = new ArrayList<NeutronSecurityGroup>();
+ List<NeutronSecurityGroup> securityGroups = new ArrayList<>();
securityGroups.add(neutronSecurityGroup);
when(neutronPort.getSecurityGroups()).thenReturn(securityGroups);
NeutronNetwork neutronNetwork = mock(NeutronNetwork.class);
when(neutronNetwork.getProviderSegmentationID()).thenReturn(SEG_ID);
when(neutronNetwork.getNetworkUUID()).thenReturn(NETWORK_ID);
- List<NeutronNetwork> listNeutronNetwork = new ArrayList<NeutronNetwork>();
+ List<NeutronNetwork> listNeutronNetwork = new ArrayList<>();
listNeutronNetwork.add(neutronNetwork);
when(neutronNetworkCache.getAllNetworks()).thenReturn(listNeutronNetwork);
when(neutronPort.getNetworkUUID()).thenReturn(NETWORK_ID);
when(neutronPortCache.getPort(anyString())).thenReturn(neutronPort);
- List<OvsdbTerminationPointAugmentation> ports = new ArrayList<OvsdbTerminationPointAugmentation>();
+ List<OvsdbTerminationPointAugmentation> ports = new ArrayList<>();
ports.add(mock(OvsdbTerminationPointAugmentation.class));
when(southbound.getTerminationPointsOfBridge(any(Node.class))).thenReturn(ports);
@Test
public void testGetNetworkId() {
NeutronNetwork neutronNetwork = mock(NeutronNetwork.class);
- List<NeutronNetwork> listNeutronNetwork = new ArrayList<NeutronNetwork>();
+ List<NeutronNetwork> listNeutronNetwork = new ArrayList<>();
listNeutronNetwork.add(neutronNetwork);
when(neutronNetwork.getProviderSegmentationID()).thenReturn("segId");
@Before
public void setUp(){
when(southbound.getOvsdbNodeUUID(any(Node.class))).thenReturn(NODE_UUID);
- List<OvsdbTerminationPointAugmentation> ports = new ArrayList<OvsdbTerminationPointAugmentation>();
+ List<OvsdbTerminationPointAugmentation> ports = new ArrayList<>();
OvsdbTerminationPointAugmentation port = mock(OvsdbTerminationPointAugmentation.class);
VlanId vlanId = mock(VlanId.class);
when(vlanId.getValue()).thenReturn(VLAN_ID);