public static IpPrefixOrAddress getDefaultInstance(String defaultValue) { try { IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(defaultValue); return new IpPrefixOrAddress(ipPrefix); } catch (IllegalArgumentException e) { LOG.debug("{} is not of IpPrefix type; checking whether it's a IpAddress type", defaultValue); IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue); return new IpPrefixOrAddress(ipAddress); } } }
private static boolean isIPv4Address(AllowedAddressPairs aap) { IpPrefixOrAddress ipPrefixOrAddress = aap.getIpAddress(); IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix(); if (ipPrefix != null) { if (ipPrefix.getIpv4Prefix() != null) { return true; } } else { IpAddress ipAddress = ipPrefixOrAddress.getIpAddress(); if (ipAddress.getIpv4Address() != null) { return true; } } return false; }
+ String.valueOf(attachIp.getValue()) + "_" + flowId; syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName, priority, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
+ String.valueOf(attachIp.getValue()) + "_" + flowId; syncFlow(dpId, NwConstants.INGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
/** * Gets the acl allowed address pairs. * * @param macAddress the mac address * @param ipAddress the ip address * @return the acl allowed address pairs */ protected static AllowedAddressPairs getAclAllowedAddressPairs(MacAddress macAddress, org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress ipAddress) { AllowedAddressPairsBuilder aclAllowedAdressPairBuilder = new AllowedAddressPairsBuilder(); aclAllowedAdressPairBuilder.setMacAddress(macAddress); if (ipAddress != null && ipAddress.getValue() != null) { if (ipAddress.getIpPrefix() != null) { aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpPrefix())); } else { aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpAddress())); } } return aclAllowedAdressPairBuilder.build(); }
MatchCriteria matchCriteria) { List<MatchInfoBase> flowMatches = new ArrayList<>(); IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix(); MatchFieldType matchFieldType; if (ipPrefix != null) { IpAddress ipAddress = ipPrefixOrAddress.getIpAddress(); if (ipAddress.getIpv4Address() != null) { matchFieldType = (matchCriteria == MatchCriteria.MATCH_SOURCE)
instructions.add(new InstructionInfo(InstructionType.apply_actions, actionsInfos)); String flowName = "Ingress_Fixed_Conntrk_Untrk_" + dpId + "_" + attachMac + "_" + String.valueOf(attachIp.getValue()) + "_" + flowId; syncFlow(dpId, NwConstants.EGRESS_ACL_TABLE, flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);